Class: VariableCallNode

Inherits:
Node
  • Object
show all
Defined in:
lib/nodes/stmtnodes.rb

Overview

Variable Nodes

Instance Attribute Summary collapse

Attributes inherited from Node

#value

Instance Method Summary collapse

Methods inherited from Node

#to_s

Constructor Details

#initialize(name) ⇒ VariableCallNode

Returns a new instance of VariableCallNode.



8
9
10
# File 'lib/nodes/stmtnodes.rb', line 8

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/nodes/stmtnodes.rb', line 6

def name
  @name
end

Instance Method Details

#evaluateObject



12
13
14
15
# File 'lib/nodes/stmtnodes.rb', line 12

def evaluate
  @value = ScopeManager.lookup_var(@name)
  return @value
end