Class: Rubinius::AST::GlobalVariableAccess

Inherits:
VariableAccess show all
Defined in:
lib/compiler/ast/variables.rb

Constant Summary collapse

EnglishBackrefs =
{
  :$LAST_MATCH_INFO => :~,
  :$MATCH => :&,
  :$PREMATCH => :'`',
  :$POSTMATCH => :"'",
  :$LAST_PAREN_MATCH => :+,
}

Instance Attribute Summary

Attributes inherited from VariableAccess

#name

Attributes inherited from Node

#line

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from VariableAccess

#initialize

Methods inherited from Node

#ascii_graph, #attributes, #children, #initialize, match_arguments?, match_send?, #new_block_generator, #new_generator, node_name, #node_name, #pos, #set_child, #transform, transform, transform_comment, transform_kind, transform_kind=, transform_name, #visit, #walk

Constructor Details

This class inherits a constructor from Rubinius::AST::VariableAccess

Class Method Details

.for_name(line, name) ⇒ Object



111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/compiler/ast/variables.rb', line 111

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

#to_sexpObject



126
127
128
# File 'lib/compiler/ast/variables.rb', line 126

def to_sexp
  [:gvar, @name]
end