Class: VariableCallNode
Overview
Variable Nodes
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Node
Instance Method Summary collapse
- #create_tree_entry ⇒ Object
- #evaluate ⇒ Object
-
#initialize(name) ⇒ VariableCallNode
constructor
A new instance of VariableCallNode.
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ VariableCallNode
Returns a new instance of VariableCallNode.
14 15 16 |
# File 'lib/nodes/stmtnodes.rb', line 14 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/nodes/stmtnodes.rb', line 12 def name @name end |
Instance Method Details
#create_tree_entry ⇒ Object
18 19 20 21 22 |
# File 'lib/nodes/stmtnodes.rb', line 18 def create_tree_entry result = set_up_scope_header result += "Variable #{@name} is now #{@value}" TREE_ARRAY << result unless TREE_ARRAY[-1] == result end |
#evaluate ⇒ Object
28 29 30 31 32 |
# File 'lib/nodes/stmtnodes.rb', line 28 def evaluate @value = ScopeManager.lookup_var(@name) create_tree_entry if PRINT_TREE_FLAG return @value end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/nodes/stmtnodes.rb', line 24 def to_s @name end |