class SyntaxTree::YARV::OptNewArraySend
### Summary
‘opt_newarray_send` is a specialization that occurs when a dynamic array literal is created and immediately sent the `min`, `max`, or `hash` methods. It pops the values of the array off the stack and pushes on the result of the method call.
### Usage
~~~ruby [a, b, c].max ~~~
Attributes
method[R]
number[R]
Public Class Methods
new(number, method)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3835 def initialize(number, method) @number = number @method = method end
Public Instance Methods
==(other)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3855 def ==(other) other.is_a?(OptNewArraySend) && other.number == number && other.method == method end
call(vm)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3872 def call(vm) vm.push(vm.pop(number).__send__(method)) end
deconstruct_keys(_keys)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3851 def deconstruct_keys(_keys) { number: number, method: method } end
disasm(fmt)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3840 def disasm(fmt) fmt.instruction( "opt_newarray_send", [fmt.object(number), fmt.object(method)] ) end
length()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3860 def length 3 end
pops()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3864 def pops number end
pushes()
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3868 def pushes 1 end
to_a(_iseq)
click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 3847 def to_a(_iseq) [:opt_newarray_send, number, method] end