Class: Rubinius::ToolSet.current::TS::AST::ClassVariableAccess
Instance Attribute Summary
#name
Attributes inherited from Node
#line
Instance Method Summary
collapse
#initialize, #value_defined
Methods inherited from Node
#ascii_graph, #attributes, #children, #initialize, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Instance Method Details
#bytecode(g) ⇒ Object
162
163
164
165
166
167
|
# File 'lib/rubinius/ast/variables.rb', line 162
def bytecode(g)
pos(g)
push_scope(g)
g.send :class_variable_get, 1
end
|
#defined(g) ⇒ Object
184
185
186
187
188
189
190
191
192
193
194
195
196
|
# File 'lib/rubinius/ast/variables.rb', line 184
def defined(g)
f = g.new_label
done = g.new_label
variable_defined(g, f)
g.push_literal "class variable"
g.goto done
f.set!
g.push :nil
done.set!
end
|
#or_bytecode(g) ⇒ Object
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'lib/rubinius/ast/variables.rb', line 141
def or_bytecode(g)
pos(g)
done = g.new_label
notfound = g.new_label
variable_defined(g, notfound)
bytecode(g)
g.dup
g.git done
g.pop
notfound.set!
yield
done.set!
end
|
#push_scope(g) ⇒ Object
169
170
171
172
173
174
175
176
|
# File 'lib/rubinius/ast/variables.rb', line 169
def push_scope(g)
if g.state.scope.module?
g.push :self
else
g.push_scope
end
g.push_literal @name
end
|
#to_sexp ⇒ Object
198
199
200
|
# File 'lib/rubinius/ast/variables.rb', line 198
def to_sexp
[:cvar, @name]
end
|
#variable_defined(g, f) ⇒ Object
178
179
180
181
182
|
# File 'lib/rubinius/ast/variables.rb', line 178
def variable_defined(g, f)
push_scope(g)
g.send :class_variable_defined?, 1
g.gif f
end
|