Class: TRuby::IR::Node
- Inherits:
-
Object
- Object
- TRuby::IR::Node
- Defined in:
- lib/t_ruby/ir.rb
Overview
Base class for all IR nodes
Direct Known Subclasses
ArrayLiteral, Assignment, BeginBlock, BinaryOp, Block, CaseExpr, ClassDecl, Conditional, ForLoop, HashLiteral, HashPair, Interface, InterfaceMember, Lambda, Literal, Loop, MethodCall, MethodDef, ModuleDecl, Parameter, Program, RawCode, RescueClause, Return, TypeAlias, TypeCast, TypeGuard, TypeNode, UnaryOp, VariableRef, WhenClause
Instance Attribute Summary collapse
-
#location ⇒ Object
Returns the value of attribute location.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#type_info ⇒ Object
Returns the value of attribute type_info.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #children ⇒ Object
-
#initialize(location: nil) ⇒ Node
constructor
A new instance of Node.
- #transform(&block) ⇒ Object
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
#location ⇒ Object
Returns the value of attribute location.
7 8 9 |
# File 'lib/t_ruby/ir.rb', line 7 def location @location end |
#metadata ⇒ Object
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/t_ruby/ir.rb', line 7 def @metadata end |
#type_info ⇒ Object
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 |
#children ⇒ Object
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 |