Class: Rubasteme::AST::LetNode
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) ⇒ LetNode
Returns a new instance of LetNode.
468
469
470
471
472
|
# File 'lib/rubasteme/ast/branch_node.rb', line 468
def initialize(_ = nil)
super(1, _)
end
|
Instance Method Details
#bindings ⇒ Object
482
483
484
|
# File 'lib/rubasteme/ast/branch_node.rb', line 482
def bindings
named_let? ? @nodes[1] : @nodes[0]
end
|
#bindings=(node) ⇒ Object
486
487
488
489
490
491
492
|
# File 'lib/rubasteme/ast/branch_node.rb', line 486
def bindings=(node)
if named_let?
@nodes[1] = node
else
@nodes[0] = node
end
end
|
#body ⇒ Object
494
495
496
|
# File 'lib/rubasteme/ast/branch_node.rb', line 494
def body
named_let? ? @nodes[2] : @nodes[1]
end
|
#body=(node) ⇒ Object
498
499
500
501
|
# File 'lib/rubasteme/ast/branch_node.rb', line 498
def body=(node)
start_pos = named_let? ? 2 : 1
@nodes[start_pos] = node
end
|
#identifier ⇒ Object
474
475
476
|
# File 'lib/rubasteme/ast/branch_node.rb', line 474
def identifier
named_let? ? @nodes[0] : nil
end
|
#identifier=(node) ⇒ Object
478
479
480
|
# File 'lib/rubasteme/ast/branch_node.rb', line 478
def identifier=(node)
@nodes.insert(0, node) if node.type == :ast_identifier
end
|