Class: CodeTools::AST::VariableAssignment

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/code/ast/variables.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #bytecode, #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, name, value) ⇒ VariableAssignment

Returns a new instance of VariableAssignment.



121
122
123
124
125
# File 'lib/rubinius/code/ast/variables.rb', line 121

def initialize(line, name, value)
  @line = line
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



119
120
121
# File 'lib/rubinius/code/ast/variables.rb', line 119

def name
  @name
end

#valueObject

Returns the value of attribute value.



119
120
121
# File 'lib/rubinius/code/ast/variables.rb', line 119

def value
  @value
end

Instance Method Details

#defined(g) ⇒ Object



127
128
129
# File 'lib/rubinius/code/ast/variables.rb', line 127

def defined(g)
  g.push_literal "assignment"
end

#to_sexpObject



131
132
133
134
135
# File 'lib/rubinius/code/ast/variables.rb', line 131

def to_sexp
  sexp = [sexp_name, @name]
  sexp << @value.to_sexp if @value
  sexp
end