class SyntaxTree::YARV::GetBlockParamProxy

### Summary

‘getblockparamproxy` is almost the same as `getblockparam` except that it pushes a proxy object onto the stack instead of the actual value of the block local. This is used when a method is being called on the block local.

### Usage

~~~ruby def foo(&block)

block.call

end ~~~

Attributes

index[R]
level[R]

Public Class Methods

new(index, level) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1544
def initialize(index, level)
  @index = index
  @level = level
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1566
def ==(other)
  other.is_a?(GetBlockParamProxy) && other.index == index &&
    other.level == level
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1579
def call(vm)
  vm.push(vm.local_get(index, level))
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1562
def deconstruct_keys(_keys)
  { index: index, level: level }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1549
def disasm(fmt)
  fmt.instruction(
    "getblockparamproxy",
    [fmt.local(index, explicit: level)]
  )
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1571
def length
  3
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1575
def pushes
  1
end
to_a(iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1556
def to_a(iseq)
  current = iseq
  level.times { current = iseq.parent_iseq }
  [:getblockparamproxy, current.local_table.offset(index), level]
end