Class: SyntaxTree::YARV::OptRegExpMatch2
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptRegExpMatch2
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
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
-
#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) ⇒ OptRegExpMatch2
constructor
A new instance of OptRegExpMatch2.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptRegExpMatch2
4388 4389 4390 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4388 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
4386 4387 4388 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4386 def calldata @calldata end |
Instance Method Details
#==(other) ⇒ Object
4404 4405 4406 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4404 def ==(other) other.is_a?(OptRegExpMatch2) && other.calldata == calldata end |
#call(vm) ⇒ Object
4424 4425 4426 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4424 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
4420 4421 4422 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4420 def canonical Send.new(calldata, nil) end |
#deconstruct_keys(_keys) ⇒ Object
4400 4401 4402 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4400 def deconstruct_keys(_keys) { calldata: calldata } end |
#disasm(fmt) ⇒ Object
4392 4393 4394 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4392 def disasm(fmt) fmt.instruction("opt_regexpmatch2", [fmt.calldata(calldata)]) end |
#length ⇒ Object
4408 4409 4410 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4408 def length 2 end |
#pops ⇒ Object
4412 4413 4414 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4412 def pops 2 end |
#pushes ⇒ Object
4416 4417 4418 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4416 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4396 4397 4398 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4396 def to_a(_iseq) [:opt_regexpmatch2, calldata.to_h] end |