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.
106 107 108 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 106 def initialize(name = nil) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
99 100 101 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 99 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.
104 105 106 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 104 def node @node end |
Instance Method Details
#inspect ⇒ Object
114 115 116 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 114 def inspect name.inspect end |
#patch!(name) ⇒ Object
110 111 112 |
# File 'lib/syntax_tree/yarv/instruction_sequence.rb', line 110 def patch!(name) @name = name end |