class SyntaxTree::YARV::OptArefWith

### Summary

‘opt_aref_with` is a specialization of the `opt_aref` instruction that occurs when the `[]` operator is used with a string argument known at compile time. There are fast paths if the receiver is a hash. It pops the receiver off the stack and pushes on the result.

### Usage

~~~ruby ‘test’ => true ~~~

Attributes

calldata[R]
object[R]

Public Class Methods

new(object, calldata) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2784
def initialize(object, calldata)
  @object = object
  @calldata = calldata
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2804
def ==(other)
  other.is_a?(OptArefWith) && other.object == object &&
    other.calldata == calldata
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2821
def call(vm)
  vm.push(vm.pop[object])
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2800
def deconstruct_keys(_keys)
  { object: object, calldata: calldata }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2789
def disasm(fmt)
  fmt.instruction(
    "opt_aref_with",
    [fmt.object(object), fmt.calldata(calldata)]
  )
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2809
def length
  3
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2813
def pops
  1
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2817
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2796
def to_a(_iseq)
  [:opt_aref_with, object, calldata.to_h]
end