class CodeTools::AST::ArrayLiteral
Attributes
body[RW]
Public Class Methods
new(line, array)
click to toggle source
# File lib/rubinius/code/ast/literals.rb, line 7 def initialize(line, array) @line = line @body = array end
Public Instance Methods
bytecode(g)
click to toggle source
# File lib/rubinius/code/ast/literals.rb, line 12 def bytecode(g) pos(g) @body.each do |x| x.bytecode(g) end g.make_array @body.size end
defined(g)
click to toggle source
# File lib/rubinius/code/ast/literals.rb, line 22 def defined(g) not_found = g.new_label done = g.new_label @body.each do |x| x.defined(g) g.goto_if_false not_found end g.push_literal "expression" g.goto done not_found.set! g.push_tagged_nil 0 g.goto done done.set! end
to_sexp()
click to toggle source
# File lib/rubinius/code/ast/literals.rb, line 38 def to_sexp @body.inject([:array]) { |s, x| s << x.to_sexp } end