Class: SyntaxTree::YARV::AdjustStack
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::AdjustStack
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(number) ⇒ AdjustStack
constructor
A new instance of AdjustStack.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(number) ⇒ AdjustStack
Returns a new instance of AdjustStack.
82 83 84 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 82 def initialize(number) @number = number end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
80 81 82 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 80 def number @number end |
Instance Method Details
#==(other) ⇒ Object
98 99 100 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 98 def ==(other) other.is_a?(AdjustStack) && other.number == number end |
#call(vm) ⇒ Object
118 119 120 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 118 def call(vm) vm.pop(number) end |
#canonical ⇒ Object
114 115 116 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 114 def canonical self end |
#deconstruct_keys(_keys) ⇒ Object
94 95 96 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 94 def deconstruct_keys(_keys) { number: number } end |
#disasm(fmt) ⇒ Object
86 87 88 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 86 def disasm(fmt) fmt.instruction("adjuststack", [fmt.object(number)]) end |
#length ⇒ Object
102 103 104 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 102 def length 2 end |
#pops ⇒ Object
106 107 108 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 106 def pops number end |
#pushes ⇒ Object
110 111 112 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 110 def pushes 0 end |
#to_a(_iseq) ⇒ Object
90 91 92 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 90 def to_a(_iseq) [:adjuststack, number] end |