Class: Ikra::AST::SourceCodeExprNode

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

Overview

A synthetic AST node. Contains its string translation directly.

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(code:) ⇒ SourceCodeExprNode

Returns a new instance of SourceCodeExprNode.



297
298
299
# File 'lib/ast/nodes.rb', line 297

def initialize(code:)
    @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



295
296
297
# File 'lib/ast/nodes.rb', line 295

def code
  @code
end

Instance Method Details

#accept(visitor) ⇒ Object



56
57
58
# File 'lib/ast/visitor.rb', line 56

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

#cloneObject



301
302
303
# File 'lib/ast/nodes.rb', line 301

def clone
    return SourceCodeExprNode.new(code: @code)
end

#to_sObject



52
53
54
# File 'lib/ast/printer.rb', line 52

def to_s
    return "[SourceCodeExprNode: #{code}]"
end