Class: Ikra::AST::ConstNode

Inherits:
TreeNode show all
Defined in:
lib/ast/nodes.rb,
lib/ast/printer.rb,
lib/ast/visitor.rb

Constant Summary

Constants inherited from TreeNode

TreeNode::TYPE_INFO_VARS

Instance Attribute Summary collapse

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods inherited from TreeNode

#==, #enclosing_class, #find_behavior_node, #get_type, #is_begin_node?, #merge_union_type, #register_type_change, #replace, #replace_child, #symbol_table

Methods inherited from Node

#==, #eql?, #hash

Constructor Details

#initialize(identifier:) ⇒ ConstNode

Returns a new instance of ConstNode.



322
323
324
# File 'lib/ast/nodes.rb', line 322

def initialize(identifier:)
    @identifier = identifier
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



320
321
322
# File 'lib/ast/nodes.rb', line 320

def identifier
  @identifier
end

Instance Method Details

#accept(visitor) ⇒ Object



68
69
70
# File 'lib/ast/visitor.rb', line 68

def accept(visitor)
    visitor.visit_const_node(self)
end

#cloneObject



326
327
328
# File 'lib/ast/nodes.rb', line 326

def clone
    return ConstNode.new(identifier: @identifier)
end

#to_sObject



66
67
68
# File 'lib/ast/printer.rb', line 66

def to_s
    return "[ConstNode: #{identifier.to_s}]"
end