class CodeTools::AST::ConstantAssignment

Attributes

constant[RW]
value[RW]

Public Class Methods

new(line, expr, value) click to toggle source
# File lib/rubinius/code/ast/constants.rb, line 296
def initialize(line, expr, value)
  @line = line
  @value = value

  if expr.kind_of? Symbol
    @constant = ConstantAccess.new line, expr
  else
    @constant = expr
  end
end

Public Instance Methods

bytecode(g) click to toggle source
# File lib/rubinius/code/ast/constants.rb, line 313
def bytecode(g)
  pos(g)

  return masgn_bytecode(g) if g.state.masgn?

  @constant.assign_bytecode(g, @value)
  g.send :const_set, 2
end
masgn_bytecode(g) click to toggle source
# File lib/rubinius/code/ast/constants.rb, line 307
def masgn_bytecode(g)
  @constant.masgn_bytecode(g)
  g.swap
  g.send :const_set, 2
end
to_sexp() click to toggle source
# File lib/rubinius/code/ast/constants.rb, line 322
def to_sexp
  sexp = [:cdecl, @constant.assign_sexp]
  sexp << @value.to_sexp if @value
  sexp
end