Class: CodeTools::AST::Negate
- Defined in:
- lib/rubinius/code/ast/sends.rb
Instance Attribute Summary collapse
- 
  
    
      #value  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute value. 
Attributes inherited from Node
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
- 
  
    
      #initialize(line, value)  ⇒ Negate 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Negate. 
- #to_sexp ⇒ Object
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) ⇒ Negate
Returns a new instance of Negate.
| 969 970 971 972 | # File 'lib/rubinius/code/ast/sends.rb', line 969 def initialize(line, value) @line = line @value = value end | 
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
| 967 968 969 | # File 'lib/rubinius/code/ast/sends.rb', line 967 def value @value end | 
Instance Method Details
#bytecode(g) ⇒ Object
| 974 975 976 977 978 979 980 981 982 983 984 985 | # File 'lib/rubinius/code/ast/sends.rb', line 974 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 ⇒ Object
| 987 988 989 | # File 'lib/rubinius/code/ast/sends.rb', line 987 def to_sexp [:negate, @value.to_sexp] end |