class SyntaxTree::YARV::DupN

### Summary

‘dupn` duplicates the top `n` stack elements.

### Usage

~~~ruby Object::X ||= true ~~~

Attributes

number[R]

Public Class Methods

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

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1361
def ==(other)
  other.is_a?(DupN) && other.number == number
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1373
def call(vm)
  values = vm.pop(number)
  vm.push(*values)
  vm.push(*values)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1357
def deconstruct_keys(_keys)
  { number: number }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1349
def disasm(fmt)
  fmt.instruction("dupn", [fmt.object(number)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1365
def length
  2
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1369
def pushes
  number
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1353
def to_a(_iseq)
  [:dupn, number]
end