class SyntaxTree::YARV::Jump
### Summary
‘jump` unconditionally jumps to the label given as its only argument.
### Usage
~~~ruby x = 0 if x == 0
puts "0"
else
puts "2"
end ~~~
Attributes
label[R]
Public Class Methods
new(label)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2220 def initialize(label) @label = label end
Public Instance Methods
==(other)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2236 def ==(other) other.is_a?(Jump) && other.label == label end
branch_targets()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2248 def branch_targets [label] end
call(vm)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2244 def call(vm) vm.jump(label) end
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2232 def deconstruct_keys(_keys) { label: label } end
disasm(fmt)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2224 def disasm(fmt) fmt.instruction("jump", [fmt.label(label)]) end
length()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2240 def length 2 end
to_a(_iseq)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2228 def to_a(_iseq) [:jump, label.name] end