Class: SyntaxTree::YARV::OptAsetWith
Overview
### Summary
‘opt_aset_with` is an instruction for setting the hash value by the known string key in the `recv = set` format. It pops the receiver 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, #canonical, #falls_through?, #leaves?, #side_effects?
Constructor Details
#initialize(object, calldata) ⇒ OptAsetWith
Returns a new instance of OptAsetWith.
2951
2952
2953
2954
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2951
def initialize(object, calldata)
@object = object
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
2949
2950
2951
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2949
def calldata
@calldata
end
|
#object ⇒ Object
Returns the value of attribute object.
2949
2950
2951
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2949
def object
@object
end
|
Instance Method Details
#==(other) ⇒ Object
2971
2972
2973
2974
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2971
def ==(other)
other.is_a?(OptAsetWith) && other.object == object &&
other.calldata == calldata
end
|
#call(vm) ⇒ Object
2988
2989
2990
2991
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2988
def call(vm)
hash, value = vm.pop(2)
vm.push(hash[object] = value)
end
|
#deconstruct_keys(_keys) ⇒ Object
2967
2968
2969
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2967
def deconstruct_keys(_keys)
{ object: object, calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
2956
2957
2958
2959
2960
2961
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2956
def disasm(fmt)
fmt.instruction(
"opt_aset_with",
[fmt.object(object), fmt.calldata(calldata)]
)
end
|
#length ⇒ Object
2976
2977
2978
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2976
def length
3
end
|
#pops ⇒ Object
2980
2981
2982
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2980
def pops
2
end
|
#pushes ⇒ Object
2984
2985
2986
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2984
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
2963
2964
2965
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 2963
def to_a(_iseq)
[:opt_aset_with, object, calldata.to_h]
end
|