Class: TRuby::IR::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/t_ruby/ir.rb

Overview

Base class for all IR nodes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location: nil) ⇒ Node

Returns a new instance of Node.



9
10
11
12
13
# File 'lib/t_ruby/ir.rb', line 9

def initialize(location: nil)
  @location = location
  @type_info = nil
  @metadata = {}
end

Instance Attribute Details

#locationObject

Returns the value of attribute location.



7
8
9
# File 'lib/t_ruby/ir.rb', line 7

def location
  @location
end

#metadataObject

Returns the value of attribute metadata.



7
8
9
# File 'lib/t_ruby/ir.rb', line 7

def 
  @metadata
end

#type_infoObject

Returns the value of attribute type_info.



7
8
9
# File 'lib/t_ruby/ir.rb', line 7

def type_info
  @type_info
end

Instance Method Details

#accept(visitor) ⇒ Object



15
16
17
# File 'lib/t_ruby/ir.rb', line 15

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

#childrenObject



19
20
21
# File 'lib/t_ruby/ir.rb', line 19

def children
  []
end

#transform(&block) ⇒ Object



23
24
25
# File 'lib/t_ruby/ir.rb', line 23

def transform(&block)
  block.call(self)
end