Class: Rubasteme::AST::ProcedureCallNode

Inherits:
ListNode show all
Defined in:
lib/rubasteme/ast/branch_node.rb

Instance Method Summary collapse

Methods inherited from ListNode

#elements, #empty?, #first, #rest

Methods inherited from BranchNode

#<<, #[], #[]=, #each, #size, #to_a

Methods inherited from Node

#to_a, #to_s, #type

Constructor Details

#initialize(_ = nil) ⇒ ProcedureCallNode

Returns a new instance of ProcedureCallNode.



86
87
88
89
# File 'lib/rubasteme/ast/branch_node.rb', line 86

def initialize(_ = nil)
  # @nodes = [<operator>, <operand>*]
  super(1, _)
end

Instance Method Details

#add_operand(node) ⇒ Object



103
104
105
# File 'lib/rubasteme/ast/branch_node.rb', line 103

def add_operand(node)
  @nodes << node
end

#operandsObject



99
100
101
# File 'lib/rubasteme/ast/branch_node.rb', line 99

def operands
  @nodes[1..-1]
end

#operatorObject



91
92
93
# File 'lib/rubasteme/ast/branch_node.rb', line 91

def operator
  @nodes[0]
end

#operator=(node) ⇒ Object



95
96
97
# File 'lib/rubasteme/ast/branch_node.rb', line 95

def operator=(node)
  @nodes[0] = node
end