Class: Rubasteme::AST::LambdaExpressionNode

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) ⇒ LambdaExpressionNode

Returns a new instance of LambdaExpressionNode.



109
110
111
112
# File 'lib/rubasteme/ast/branch_node.rb', line 109

def initialize(_ = nil)
  # @nodes = [<formals>, <body>]
  super(2, _)
end

Instance Method Details

#bodyObject



122
123
124
# File 'lib/rubasteme/ast/branch_node.rb', line 122

def body
  @nodes[1]
end

#body=(node) ⇒ Object



126
127
128
# File 'lib/rubasteme/ast/branch_node.rb', line 126

def body=(node)
  @nodes[1] = node
end

#formalsObject



114
115
116
# File 'lib/rubasteme/ast/branch_node.rb', line 114

def formals
  @nodes[0]
end

#formals=(node) ⇒ Object



118
119
120
# File 'lib/rubasteme/ast/branch_node.rb', line 118

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