Class: SyntaxTree::YARV::InstructionSequence::Label
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::InstructionSequence::Label
- Defined in:
- lib/syntax_tree/yarv/instruction_sequence.rb
Overview
This represents the destination of instructions that jump. Initially it does not track its position so that when we perform optimizations the indices don’t get messed up.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node ⇒ Object
When we’re serializing the instruction sequence, we need to be able to look up the label from the branch instructions and then access the subsequent node.
Instance Method Summary collapse
-
#initialize(name = nil) ⇒ Label
constructor
A new instance of Label.
- #inspect ⇒ Object
- #patch!(name) ⇒ Object
Constructor Details
#initialize(name = nil) ⇒ Label
Returns a new instance of Label.
115 116 117 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 115 def initialize(name = nil) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
108 109 110 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 108 def name @name end |
#node ⇒ Object
When we’re serializing the instruction sequence, we need to be able to look up the label from the branch instructions and then access the subsequent node. So we’ll store the reference here.
113 114 115 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 113 def node @node end |
Instance Method Details
#inspect ⇒ Object
123 124 125 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 123 def inspect name.inspect end |
#patch!(name) ⇒ Object
119 120 121 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 119 def patch!(name) @name = name end |