class Kaguya::AST::Node

Attributes

children[R]
parent[R]
type[R]

Public Class Methods

new(type:, parent:) click to toggle source

@param [Symbol] type @param [Node] parent

# File lib/kaguya/ast/node.rb, line 12
def initialize(type:, parent:)
  @type = type
  @parent = parent
  @children = []

  @parent.children << self if @parent
end

Public Instance Methods

accept(compiler) click to toggle source

@param [Compiler] compiler @return [Array]

# File lib/kaguya/ast/node.rb, line 22
def accept(compiler)
  compiler.visit(self)
end
to_s() click to toggle source

@return [String]

# File lib/kaguya/ast/node.rb, line 27
def to_s
  @type.to_s
end