Class: CodeTools::AST::SValue

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/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.



218
219
220
221
# File 'lib/rubinius/ast/values.rb', line 218

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

Instance Attribute Details

#valueObject

Returns the value of attribute value.



216
217
218
# File 'lib/rubinius/ast/values.rb', line 216

def value
  @value
end

Instance Method Details

#bytecode(g) ⇒ Object



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/rubinius/ast/values.rb', line 223

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

    g.dup
    g.send :size, 0
    g.push 1
    g.send :>, 1
    g.git done

    g.push 0
    g.send :at, 1

    done.set!
  end
end

#to_sexpObject



241
242
243
# File 'lib/rubinius/ast/values.rb', line 241

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