Class: Ikra::AST::IntLiteralNode

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(value:) ⇒ IntLiteralNode

Returns a new instance of IntLiteralNode.



376
377
378
# File 'lib/ast/nodes.rb', line 376

def initialize(value:)
    @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



374
375
376
# File 'lib/ast/nodes.rb', line 374

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



92
93
94
# File 'lib/ast/visitor.rb', line 92

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

#cloneObject



380
381
382
# File 'lib/ast/nodes.rb', line 380

def clone
    return IntLiteralNode.new(value: @value)
end

#to_sObject



84
85
86
# File 'lib/ast/printer.rb', line 84

def to_s
    return "<#{value.to_s}>"
end