Class: CodeTools::AST::BlockPass
- Inherits:
-
Node
- Object
- Node
- CodeTools::AST::BlockPass
show all
- Defined in:
- lib/rubinius/code/ast/sends.rb
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.
397
398
399
400
|
# File 'lib/rubinius/code/ast/sends.rb', line 397
def initialize(line, body)
@line = line
@body = body
end
|
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
395
396
397
|
# File 'lib/rubinius/code/ast/sends.rb', line 395
def body
@body
end
|
Instance Method Details
#assignment_bytecode(g) ⇒ Object
421
422
423
424
|
# File 'lib/rubinius/code/ast/sends.rb', line 421
def assignment_bytecode(g)
g.push_proc
@body.bytecode(g)
end
|
#bytecode(g) ⇒ Object
416
417
418
419
|
# File 'lib/rubinius/code/ast/sends.rb', line 416
def bytecode(g)
@body.bytecode(g)
convert(g)
end
|
#convert(g) ⇒ Object
402
403
404
405
406
407
408
409
410
411
412
413
414
|
# File 'lib/rubinius/code/ast/sends.rb', line 402
def convert(g)
nil_block = g.new_label
g.dup
g.goto_if_nil nil_block
g.push_cpath_top
g.find_const :Proc
g.swap
g.send :__from_block__, 1
nil_block.set!
end
|
#to_sexp ⇒ Object
426
427
428
|
# File 'lib/rubinius/code/ast/sends.rb', line 426
def to_sexp
[:block_pass, @body.to_sexp]
end
|