class SyntaxTree::YARV::SetN
### Summary
‘setn` sets a value in the stack to a value popped off the top of the stack. It then pushes that value onto the top of the stack as well.
### Usage
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5476 def initialize(number) @number = number end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5492 def ==(other) other.is_a?(SetN) && other.number == number end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5508 def call(vm) vm.stack[-number - 1] = vm.stack.last end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5488 def deconstruct_keys(_keys) { number: number } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5480 def disasm(fmt) fmt.instruction("setn", [fmt.object(number)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 5484 def to_a(_iseq) [:setn, number] end