Class: FunctionDecNode
Overview
Function Nodes
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #create_tree_entry ⇒ Object
- #evaluate ⇒ Object
-
#initialize(node, value) ⇒ FunctionDecNode
constructor
A new instance of FunctionDecNode.
- #to_s ⇒ Object
Constructor Details
#initialize(node, value) ⇒ FunctionDecNode
Returns a new instance of FunctionDecNode.
79 80 81 82 83 |
# File 'lib/nodes/stmtnodes.rb', line 79 def initialize(node, value) super(value) @name = node @args = node.args end |
Instance Method Details
#create_tree_entry ⇒ Object
85 86 87 88 89 |
# File 'lib/nodes/stmtnodes.rb', line 85 def create_tree_entry result = set_up_scope_header result += "Function #{@name} declared" TREE_ARRAY << result unless TREE_ARRAY[-1] == result end |
#evaluate ⇒ Object
95 96 97 98 99 |
# File 'lib/nodes/stmtnodes.rb', line 95 def evaluate ScopeManager.add_func_to_global_scope(@name, @value, @args) create_tree_entry if PRINT_TREE_FLAG return nil end |
#to_s ⇒ Object
91 92 93 |
# File 'lib/nodes/stmtnodes.rb', line 91 def to_s "#{@name} = #{@value}" end |