Class: CodeTools::AST::SValue

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

Returns a new instance of SValue.



235
236
237
238
# File 'lib/rubinius/code/ast/values.rb', line 235

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

Instance Attribute Details

#valueObject

Returns the value of attribute value.



233
234
235
# File 'lib/rubinius/code/ast/values.rb', line 233

def value
  @value
end

Instance Method Details

#bytecode(g) ⇒ Object



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/rubinius/code/ast/values.rb', line 240

def bytecode(g)
  @value.bytecode(g)
  if @value.kind_of? SplatValue
    done = g.new_label

    g.dup
    g.send :size, 0
    g.push_int 1
    g.send :>, 1
    g.goto_if_true done

    g.push_int 0
    g.send :at, 1

    done.set!
  end
end

#to_sexpObject



258
259
260
# File 'lib/rubinius/code/ast/values.rb', line 258

def to_sexp
  [:svalue, @value.to_sexp]
end