Class: Rubinius::AST::VariableAssignment

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

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #children, 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

#initialize(line, name, value) ⇒ VariableAssignment

Returns a new instance of VariableAssignment.



61
62
63
64
65
# File 'lib/compiler/ast/variables.rb', line 61

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



59
60
61
# File 'lib/compiler/ast/variables.rb', line 59

def name
  @name
end

#valueObject

Returns the value of attribute value.



59
60
61
# File 'lib/compiler/ast/variables.rb', line 59

def value
  @value
end

Instance Method Details

#defined(g) ⇒ Object



67
68
69
# File 'lib/compiler/ast/variables.rb', line 67

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

#to_sexpObject



71
72
73
74
75
# File 'lib/compiler/ast/variables.rb', line 71

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