Class: CodeTools::AST::SplatWhen

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/code/ast/control_flow.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, condition) ⇒ SplatWhen

Returns a new instance of SplatWhen.



197
198
199
200
# File 'lib/rubinius/code/ast/control_flow.rb', line 197

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

Instance Attribute Details

#conditionObject

Returns the value of attribute condition.



195
196
197
# File 'lib/rubinius/code/ast/control_flow.rb', line 195

def condition
  @condition
end

Instance Method Details

#bytecode(g, body, nxt) ⇒ Object



215
216
217
# File 'lib/rubinius/code/ast/control_flow.rb', line 215

def bytecode(g, body, nxt)
  # TODO: why is this empty?
end

#receiver_bytecode(g, body, nxt) ⇒ Object



202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/rubinius/code/ast/control_flow.rb', line 202

def receiver_bytecode(g, body, nxt)
  pos(g)

  g.dup
  @condition.bytecode(g)
  g.cast_array
  g.push_rubinius
  g.find_const :Runtime
  g.rotate(3)
  g.send :matches_when, 2
  g.goto_if_true body
end

#to_sexpObject



219
220
221
# File 'lib/rubinius/code/ast/control_flow.rb', line 219

def to_sexp
  [:when, @condition.to_sexp, nil]
end