Class: SyntaxTree::YARV::OptEmptyP
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::OptEmptyP
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
Summary
opt_empty_p is an optimization applied when the method empty? is
called. It pops the receiver off the stack and pushes on the result of the
method call.
Usage
"".empty?
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) ⇒ OptEmptyP
constructor
A new instance of OptEmptyP.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(calldata) ⇒ OptEmptyP
Returns a new instance of OptEmptyP.
2894 2895 2896 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2894 def initialize(calldata) @calldata = calldata end |
Instance Attribute Details
#calldata ⇒ Object (readonly)
Returns the value of attribute calldata.
2892 2893 2894 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2892 def calldata @calldata end |
Instance Method Details
#call(vm) ⇒ Object
2922 2923 2924 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2922 def call(vm) canonical.call(vm) end |
#canonical ⇒ Object
2918 2919 2920 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2918 def canonical Send.new(calldata, nil) end |
#disasm(fmt) ⇒ Object
2898 2899 2900 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2898 def disasm(fmt) fmt.instruction("opt_empty_p", [fmt.calldata(calldata)]) end |
#length ⇒ Object
2906 2907 2908 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2906 def length 2 end |
#pops ⇒ Object
2910 2911 2912 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2910 def pops 1 end |
#pushes ⇒ Object
2914 2915 2916 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2914 def pushes 1 end |
#to_a(_iseq) ⇒ Object
2902 2903 2904 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2902 def to_a(_iseq) [:opt_empty_p, calldata.to_h] end |