Class: SyntaxTree::YARV::OptAset
Overview
### Summary
‘opt_aset` is an instruction for setting the hash value by the key in the `recv = set` format. It is a specialization of the `opt_send_without_block` instruction. It pops the receiver, the key, and the value off the stack and pushes on the result.
### Usage
~~~ruby = value ~~~
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #falls_through?, #leaves?, #side_effects?
Constructor Details
#initialize(calldata) ⇒ OptAset
Returns a new instance of OptAset.
2895
2896
2897
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2895
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
2893
2894
2895
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2893
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
2911
2912
2913
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2911
def ==(other)
other.is_a?(OptAset) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
2931
2932
2933
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2931
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
2927
2928
2929
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2927
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
2907
2908
2909
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2907
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
2899
2900
2901
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2899
def disasm(fmt)
fmt.instruction("opt_aset", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
2915
2916
2917
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2915
def length
2
end
|
#pops ⇒ Object
2919
2920
2921
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2919
def pops
3
end
|
#pushes ⇒ Object
2923
2924
2925
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2923
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
2903
2904
2905
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2903
def to_a(_iseq)
[:opt_aset, calldata.to_h]
end
|