class CodeTools::AST::Negate

Attributes

value[RW]

Public Class Methods

new(line, value) click to toggle source
# File lib/rubinius/code/ast/sends.rb, line 968
def initialize(line, value)
  @line = line
  @value = value
end

Public Instance Methods

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

  if @value.kind_of? FixnumLiteral
    g.push_int(-@value.value)
  elsif @value.kind_of? NumberLiteral
    g.push_literal(-@value.value)
  else
    @value.bytecode(g)
    g.send :"-@", 0
  end
end
to_sexp() click to toggle source
# File lib/rubinius/code/ast/sends.rb, line 986
def to_sexp
  [:negate, @value.to_sexp]
end