Class: CodeTools::AST::Not
- Inherits:
-
Node
- Object
- Node
- CodeTools::AST::Not
show all
- Defined in:
- lib/rubinius/code/ast/operators.rb
Instance Attribute Summary collapse
Attributes inherited from Node
#line
Instance Method Summary
collapse
Methods inherited from Node
#ascii_graph, #attributes, #children, 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) ⇒ Not
57
58
59
60
|
# File 'lib/rubinius/code/ast/operators.rb', line 57
def initialize(line, value)
@line = line
@value = value
end
|
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
55
56
57
|
# File 'lib/rubinius/code/ast/operators.rb', line 55
def value
@value
end
|
Instance Method Details
#bytecode(g) ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'lib/rubinius/code/ast/operators.rb', line 62
def bytecode(g)
true_label = g.new_label
end_label = g.new_label
@value.bytecode(g)
g.goto_if_true true_label
g.push_true
g.goto end_label
true_label.set!
g.push_false
end_label.set!
end
|
#defined(g) ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/rubinius/code/ast/operators.rb', line 77
def defined(g)
t = g.new_label
f = g.new_label
done = g.new_label
case @value
when GlobalVariableAccess, InstanceVariableAccess
g.goto t
else
@value.value_defined(g, f)
g.pop
end
t.set!
g.push_literal "expression"
g.goto done
f.set!
g.push_nil
done.set!
end
|
#to_sexp ⇒ Object
100
101
102
|
# File 'lib/rubinius/code/ast/operators.rb', line 100
def to_sexp
[:not, @value.to_sexp]
end
|