class SyntaxTree::YARV::InvokeBlock
### Summary
‘invokeblock` invokes the block given to the current method. It pops the arguments for the block off the stack and pushes the result of running the block onto the stack.
### Usage
~~~ruby def foo
yield
end ~~~
Attributes
calldata[R]
Public Class Methods
new(calldata)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2089 def initialize(calldata) @calldata = calldata end
Public Instance Methods
==(other)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2105 def ==(other) other.is_a?(InvokeBlock) && other.calldata == calldata end
call(vm)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2121 def call(vm) vm.push(vm.frame_yield.block.call(*vm.pop(calldata.argc))) end
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2101 def deconstruct_keys(_keys) { calldata: calldata } end
disasm(fmt)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2093 def disasm(fmt) fmt.instruction("invokeblock", [fmt.calldata(calldata)]) end
length()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2109 def length 2 end
pops()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2113 def pops calldata.argc end
pushes()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2117 def pushes 1 end
to_a(_iseq)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2097 def to_a(_iseq) [:invokeblock, calldata.to_h] end