class SyntaxTree::YARV::NewArray
### Summary
‘newarray` puts a new array initialized with `number` values from the stack. It pops `number` values off the stack and pushes the array onto the stack.
### Usage
~~~ruby
- “string”
-
~~~
Attributes
Public Class Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2367 def initialize(number) @number = number end
Public Instance Methods
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2383 def ==(other) other.is_a?(NewArray) && other.number == number end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2399 def call(vm) vm.push(vm.pop(number)) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2379 def deconstruct_keys(_keys) { number: number } end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2371 def disasm(fmt) fmt.instruction("newarray", [fmt.object(number)]) end
Source
# File lib/syntax_tree/yarv/instructions.rb, line 2375 def to_a(_iseq) [:newarray, number] end