Class: Rubinius::ToolSet.current::TS::AST::GlobalVariableAccess
Constant Summary
collapse
- EnglishBackrefs =
{
:$LAST_MATCH_INFO => :~,
:$MATCH => :&,
:$PREMATCH => :'`',
:$POSTMATCH => :"'",
:$LAST_PAREN_MATCH => :+,
}
Instance Attribute Summary
#name
Attributes inherited from Node
#line
Class Method Summary
collapse
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, #or_bytecode, #pos, #set_child, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk
Class Method Details
.for_name(line, name) ⇒ Object
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
# File 'lib/rubinius/ast/variables.rb', line 261
def self.for_name(line, name)
case name
when :$!
CurrentException.new(line)
when :$~
BackRef.new(line, :~)
else
if backref = EnglishBackrefs[name]
BackRef.new(line, backref)
else
new(line, name)
end
end
end
|
Instance Method Details
#bytecode(g) ⇒ Object
276
277
278
279
280
281
282
283
|
# File 'lib/rubinius/ast/variables.rb', line 276
def bytecode(g)
pos(g)
g.push_rubinius
g.find_const :Globals
g.push_literal @name
g.send :[], 1
end
|
#defined(g) ⇒ Object
293
294
295
296
297
298
299
300
301
302
303
304
305
|
# File 'lib/rubinius/ast/variables.rb', line 293
def defined(g)
f = g.new_label
done = g.new_label
variable_defined(g, f)
g.push_literal "global-variable"
g.goto done
f.set!
g.push :nil
done.set!
end
|
#to_sexp ⇒ Object
307
308
309
|
# File 'lib/rubinius/ast/variables.rb', line 307
def to_sexp
[:gvar, @name]
end
|
#variable_defined(g, f) ⇒ Object
285
286
287
288
289
290
291
|
# File 'lib/rubinius/ast/variables.rb', line 285
def variable_defined(g, f)
g.push_rubinius
g.find_const :Globals
g.push_literal @name
g.send :key?, 1
g.gif f
end
|