class CodeTools::AST::SplatValue
Attributes
value[RW]
Public Class Methods
new(line, value)
click to toggle source
# File lib/rubinius/code/ast/values.rb, line 7 def initialize(line, value) @line = line @value = value end
Public Instance Methods
bytecode(g)
click to toggle source
# File lib/rubinius/code/ast/values.rb, line 12 def bytecode(g) done = g.new_label coerce = g.new_label make_array = g.new_label dup_as_array = g.new_label @value.bytecode(g) instance_of_array(g, dup_as_array) kind_of_array(g, dup_as_array) g.dup g.push_literal :to_a g.push_true g.send :respond_to?, 2, true g.goto_if_true coerce make_array.set! g.make_array 1 g.goto done discard = g.new_label dup_as_array.set! g.dup g.push_rubinius g.find_const :Runtime g.swap g.send :dup_as_array, 1, true g.goto discard coerce.set! g.dup g.send :to_a, 0, true check_array = g.new_label g.dup g.goto_if_not_nil check_array g.pop g.goto make_array check_array.set! kind_of_array(g, discard) g.push_type g.move_down 2 g.push_literal :to_a g.push_cpath_top g.find_const :Array g.send :coerce_to_type_error, 4, true g.goto done discard.set! g.swap g.pop done.set! end
instance_of_array(g, label)
click to toggle source
# File lib/rubinius/code/ast/values.rb, line 73 def instance_of_array(g, label) g.dup g.push_cpath_top g.find_const :Array g.swap g.instance_of g.goto_if_true label end
kind_of_array(g, label)
click to toggle source
# File lib/rubinius/code/ast/values.rb, line 82 def kind_of_array(g, label) g.dup g.push_cpath_top g.find_const :Array g.swap g.kind_of g.goto_if_true label end
splat?()
click to toggle source
# File lib/rubinius/code/ast/values.rb, line 95 def splat? true end
to_sexp()
click to toggle source
# File lib/rubinius/code/ast/values.rb, line 91 def to_sexp [:splat, @value.to_sexp] end