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
- #call(vm) ⇒ Object
- #canonical ⇒ 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
Returns a new instance of OptRegExpMatch2.
3835 3836 3837 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3835 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
3833 3834 3835 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3833 def calldata @calldata end |
Instance Method Details
#call(vm) ⇒ Object
3863 3864 3865 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3863 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
3859 3860 3861 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3859 def canonical Send.new(calldata, nil) end |
#disasm(fmt) ⇒ Object
3839 3840 3841 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3839 def disasm(fmt) fmt.instruction("opt_regexpmatch2", [fmt.calldata(calldata)]) end |
#length ⇒ Object
3847 3848 3849 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3847 def length 2 end |
#pops ⇒ Object
3851 3852 3853 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3851 def pops 2 end |
#pushes ⇒ Object
3855 3856 3857 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3855 def pushes 1 end |
#to_a(_iseq) ⇒ Object
3843 3844 3845 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 3843 def to_a(_iseq) [:opt_regexpmatch2, calldata.to_h] end |