class SyntaxTree::YARV::AdjustStack

### Summary

‘adjuststack` accepts a single integer argument and removes that many elements from the top of the stack.

### Usage

~~~ruby x = [true] x ||= nil x ~~~

Attributes

number[R]

Public Class Methods

new(number) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 72
def initialize(number)
  @number = number
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 88
def ==(other)
  other.is_a?(AdjustStack) && other.number == number
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 100
def call(vm)
  vm.pop(number)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 84
def deconstruct_keys(_keys)
  { number: number }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 76
def disasm(fmt)
  fmt.instruction("adjuststack", [fmt.object(number)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 92
def length
  2
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 96
def pops
  number
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 80
def to_a(_iseq)
  [:adjuststack, number]
end