Class: CodeTools::AST::ClassVariableAssignment

Inherits:
VariableAssignment show all
Defined in:
lib/rubinius/code/ast/variables.rb

Direct Known Subclasses

ClassVariableDeclaration

Instance Attribute Summary

Attributes inherited from VariableAssignment

#name, #value

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from VariableAssignment

#defined, #initialize, #to_sexp

Methods inherited from Node

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

Constructor Details

This class inherits a constructor from CodeTools::AST::VariableAssignment

Instance Method Details

#bytecode(g) ⇒ Object



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/rubinius/code/ast/variables.rb', line 202

def bytecode(g)
  pos(g)

  if g.state.scope.module?
    g.push_self
  else
    g.push_scope
  end

  if @value
    g.push_literal @name
    @value.bytecode(g)
  else
    g.swap
    g.push_literal @name
    g.swap
  end

  pos(g)
  g.send :class_variable_set, 2
end

#sexp_nameObject



224
225
226
# File 'lib/rubinius/code/ast/variables.rb', line 224

def sexp_name
  :cvasgn
end