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
5566
5567
5568
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5566
def ==(other)
other.is_a?(Swap)
end
|
#call(vm) ⇒ Object
5578
5579
5580
5581
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5578
def call(vm)
left, right = vm.pop(2)
vm.push(right, left)
end
|
#deconstruct_keys(_keys) ⇒ Object
5562
5563
5564
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5562
def deconstruct_keys(_keys)
{}
end
|
#disasm(fmt) ⇒ Object
5554
5555
5556
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5554
def disasm(fmt)
fmt.instruction("swap")
end
|
#pops ⇒ Object
5570
5571
5572
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5570
def pops
2
end
|
#pushes ⇒ Object
5574
5575
5576
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5574
def pushes
2
end
|
#to_a(_iseq) ⇒ Object
5558
5559
5560
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5558
def to_a(_iseq)
[:swap]
end
|