Class: Rubinius::AST::BlockPass

Inherits:
Node
  • Object
show all
Defined in:
lib/compiler/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, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, node_name, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #visit, #walk

Constructor Details

#initialize(line, body) ⇒ BlockPass

Returns a new instance of BlockPass.



149
150
151
152
# File 'lib/compiler/ast/sends.rb', line 149

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

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



147
148
149
# File 'lib/compiler/ast/sends.rb', line 147

def body
  @body
end

Instance Method Details

#convert(g) ⇒ Object



154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/compiler/ast/sends.rb', line 154

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



169
170
171
# File 'lib/compiler/ast/sends.rb', line 169

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