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