Class: Rubinius::ToolSet.current::TS::AST::Negate
- Defined in:
- lib/rubinius/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.
881 882 883 884 |
# File 'lib/rubinius/ast/sends.rb', line 881 def initialize(line, value) @line = line @value = value end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
879 880 881 |
# File 'lib/rubinius/ast/sends.rb', line 879 def value @value end |
Instance Method Details
#bytecode(g) ⇒ Object
886 887 888 889 890 891 892 893 894 895 |
# File 'lib/rubinius/ast/sends.rb', line 886 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
897 898 899 |
# File 'lib/rubinius/ast/sends.rb', line 897 def to_sexp [:negate, @value.to_sexp] end |