class SyntaxTree::YARV::OptEmptyP

### 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

~~~ruby “”.empty? ~~~

Attributes

calldata[R]

Public Class Methods

new(calldata) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3090
def initialize(calldata)
  @calldata = calldata
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3106
def ==(other)
  other.is_a?(OptEmptyP) && other.calldata == calldata
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3126
def call(vm)
  canonical.call(vm)
end
canonical() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3122
def canonical
  Send.new(calldata, nil)
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3102
def deconstruct_keys(_keys)
  { calldata: calldata }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3094
def disasm(fmt)
  fmt.instruction("opt_empty_p", [fmt.calldata(calldata)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3110
def length
  2
end
pops() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3114
def pops
  1
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3118
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3098
def to_a(_iseq)
  [:opt_empty_p, calldata.to_h]
end