Class: SyntaxTree::YARV::Swap
Overview
Summary
swap swaps the top two elements in the stack.
TracePoint
swap does not dispatch any events.
Usage
!!defined?([[]])
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #canonical, #falls_through?, #leaves?, #length, #side_effects?
Instance Method Details
#==(other) ⇒ Object
5667
5668
5669
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5667
def ==(other)
other.is_a?(Swap)
end
|
#call(vm) ⇒ Object
5679
5680
5681
5682
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5679
def call(vm)
left, right = vm.pop(2)
vm.push(right, left)
end
|
#deconstruct_keys(_keys) ⇒ Object
5663
5664
5665
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5663
def deconstruct_keys(_keys)
{}
end
|
#disasm(fmt) ⇒ Object
5655
5656
5657
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5655
def disasm(fmt)
fmt.instruction("swap")
end
|
#pops ⇒ Object
5671
5672
5673
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5671
def pops
2
end
|
#pushes ⇒ Object
5675
5676
5677
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5675
def pushes
2
end
|
#to_a(_iseq) ⇒ Object
5659
5660
5661
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5659
def to_a(_iseq)
[:swap]
end
|