Class: Rubinius::ToolSet.current::TS::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.



318
319
320
321
# File 'lib/rubinius/ast/sends.rb', line 318

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

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



316
317
318
# File 'lib/rubinius/ast/sends.rb', line 316

def body
  @body
end

Instance Method Details

#assignment_bytecode(g) ⇒ Object



343
344
345
346
# File 'lib/rubinius/ast/sends.rb', line 343

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

#bytecode(g) ⇒ Object



338
339
340
341
# File 'lib/rubinius/ast/sends.rb', line 338

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

#convert(g) ⇒ Object



323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/rubinius/ast/sends.rb', line 323

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



348
349
350
# File 'lib/rubinius/ast/sends.rb', line 348

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