Class: CodeTools::AST::Negate
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.
904 905 906 907 |
# File 'lib/rubinius/ast/sends.rb', line 904 def initialize(line, value) @line = line @value = value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
902 903 904 |
# File 'lib/rubinius/ast/sends.rb', line 902 def value @value end |
Instance Method Details
#bytecode(g) ⇒ Object
909 910 911 912 913 914 915 916 917 918 |
# File 'lib/rubinius/ast/sends.rb', line 909 def bytecode(g) pos(g) if @value.kind_of? NumberLiteral g.push(-@value.value) else @value.bytecode(g) g.send :"-@", 0 end end |
#to_sexp ⇒ Object
920 921 922 |
# File 'lib/rubinius/ast/sends.rb', line 920 def to_sexp [:negate, @value.to_sexp] end |