Class: CodeTools::AST::BlockPass

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/ast/sends.rb

Direct Known Subclasses

BlockPass19

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #children, #defined, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk

Constructor Details

#initialize(line, body) ⇒ BlockPass

Returns a new instance of BlockPass.



330
331
332
333
# File 'lib/rubinius/ast/sends.rb', line 330

def initialize(line, body)
  @line = line
  @body = body
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



328
329
330
# File 'lib/rubinius/ast/sends.rb', line 328

def body
  @body
end

Instance Method Details

#assignment_bytecode(g) ⇒ Object



355
356
357
358
# File 'lib/rubinius/ast/sends.rb', line 355

def assignment_bytecode(g)
  g.push_proc
  @body.bytecode(g)
end

#bytecode(g) ⇒ Object



350
351
352
353
# File 'lib/rubinius/ast/sends.rb', line 350

def bytecode(g)
  @body.bytecode(g)
  convert(g)
end

#convert(g) ⇒ Object



335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/rubinius/ast/sends.rb', line 335

def convert(g)
  nil_block = g.new_label
  g.dup
  g.is_nil
  g.git nil_block

  g.push_cpath_top
  g.find_const :Proc

  g.swap
  g.send :__from_block__, 1

  nil_block.set!
end

#to_sexpObject



360
361
362
# File 'lib/rubinius/ast/sends.rb', line 360

def to_sexp
  [:block_pass, @body.to_sexp]
end