class Rubasteme::AST::LetNode

Public Class Methods

new(_ = nil) click to toggle source
Calls superclass method Rubasteme::AST::ListNode::new
# File lib/rubasteme/ast/branch_node.rb, line 468
def initialize(_ = nil)
  # @nodes = [<bindings>, <body>] or
  #          [<identifier>, <bindings>, <body>]
  super(1, _)
end

Public Instance Methods

bindings() click to toggle source
# File lib/rubasteme/ast/branch_node.rb, line 482
def bindings
  named_let? ? @nodes[1] : @nodes[0]
end
bindings=(node) click to toggle source
# 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() click to toggle source
# File lib/rubasteme/ast/branch_node.rb, line 494
def body
  named_let? ? @nodes[2] : @nodes[1]
end
body=(node) click to toggle source
# File lib/rubasteme/ast/branch_node.rb, line 498
def body=(node)
  start_pos = named_let? ? 2 : 1
  @nodes[start_pos] = node
end
identifier() click to toggle source
# File lib/rubasteme/ast/branch_node.rb, line 474
def identifier
  named_let? ? @nodes[0] : nil
end
identifier=(node) click to toggle source
# File lib/rubasteme/ast/branch_node.rb, line 478
def identifier=(node)
  @nodes.insert(0, node) if node.type == :ast_identifier
end

Private Instance Methods

named_let?() click to toggle source
# File lib/rubasteme/ast/branch_node.rb, line 505
def named_let?
  @nodes[0].nil? ? false : @nodes[0].type == :ast_identifier
end