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
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2142 def initialize(calldata) @calldata = calldata end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2158 def ==(other) other.is_a?(InvokeBlock) && other.calldata == calldata end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2174 def call(vm) vm.push(vm.frame_yield.block.call(*vm.pop(calldata.argc))) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2154 def deconstruct_keys(_keys) { calldata: calldata } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2146 def disasm(fmt) fmt.instruction("invokeblock", [fmt.calldata(calldata)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2150 def to_a(_iseq) [:invokeblock, calldata.to_h] end