Class: SyntaxTree::YARV::OptRegExpMatch2
Overview
### Summary
‘opt_regexpmatch2` is a specialization of the `opt_send_without_block` instruction that occurs when the `=~` operator is used. It pops both the receiver and the argument off the stack and pushes on the result.
### Usage
~~~ruby /a/ =~ “a” ~~~
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #falls_through?, #leaves?, #side_effects?
Constructor Details
4171
4172
4173
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4171
def initialize(calldata)
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
4169
4170
4171
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4169
def calldata
@calldata
end
|
Instance Method Details
#==(other) ⇒ Object
4187
4188
4189
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4187
def ==(other)
other.is_a?(OptRegExpMatch2) && other.calldata == calldata
end
|
#call(vm) ⇒ Object
4207
4208
4209
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4207
def call(vm)
canonical.call(vm)
end
|
#canonical ⇒ Object
4203
4204
4205
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4203
def canonical
Send.new(calldata, nil)
end
|
#deconstruct_keys(_keys) ⇒ Object
4183
4184
4185
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4183
def deconstruct_keys(_keys)
{ calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
4175
4176
4177
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4175
def disasm(fmt)
fmt.instruction("opt_regexpmatch2", [fmt.calldata(calldata)])
end
|
#length ⇒ Object
4191
4192
4193
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4191
def length
2
end
|
#pops ⇒ Object
4195
4196
4197
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4195
def pops
2
end
|
#pushes ⇒ Object
4199
4200
4201
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4199
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
4179
4180
4181
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4179
def to_a(_iseq)
[:opt_regexpmatch2, calldata.to_h]
end
|