Class: SyntaxTree::YARV::OptAref
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptAref
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
opt_aref is a specialization of the opt_send_without_block instruction that occurs when the [] operator is used. There are fast paths if the receiver is an integer, array, or hash.
### Usage
~~~ruby 7 ~~~
Instance Attribute Summary collapse
-
#calldata ⇒ Object
readonly
Returns the value of attribute calldata.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(calldata) ⇒ OptAref
constructor
A new instance of OptAref.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptAref
Returns a new instance of OptAref.
2923 2924 2925 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2923 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
2921 2922 2923 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2921 def calldata @calldata end |
Instance Method Details
#==(other) ⇒ Object
2939 2940 2941 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2939 def ==(other) other.is_a?(OptAref) && other.calldata == calldata end |
#call(vm) ⇒ Object
2959 2960 2961 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2959 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
2955 2956 2957 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2955 def canonical Send.new(calldata, nil) end |
#deconstruct_keys(_keys) ⇒ Object
2935 2936 2937 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2935 def deconstruct_keys(_keys) { calldata: calldata } end |
#disasm(fmt) ⇒ Object
2927 2928 2929 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2927 def disasm(fmt) fmt.instruction("opt_aref", [fmt.calldata(calldata)]) end |
#length ⇒ Object
2943 2944 2945 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2943 def length 2 end |
#pops ⇒ Object
2947 2948 2949 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2947 def pops 2 end |
#pushes ⇒ Object
2951 2952 2953 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2951 def pushes 1 end |
#to_a(_iseq) ⇒ Object
2931 2932 2933 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2931 def to_a(_iseq) [:opt_aref, calldata.to_h] end |