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.
912 913 914 915 |
# File 'lib/rubinius/code/ast/sends.rb', line 912 def initialize(line, value) @line = line @value = value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
910 911 912 |
# File 'lib/rubinius/code/ast/sends.rb', line 910 def value @value end |
Instance Method Details
#bytecode(g) ⇒ Object
917 918 919 920 921 922 923 924 925 926 927 928 |
# File 'lib/rubinius/code/ast/sends.rb', line 917 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
930 931 932 |
# File 'lib/rubinius/code/ast/sends.rb', line 930 def to_sexp [:negate, @value.to_sexp] end |