class SyntaxTree::YARV::SplatArray
~~~
x = *(5)
~~~ruby
### Usage
and the original array if there isn’t one.
by calling ‘to_a`. It pushes a duplicate of the array if there is a flag,
`splatarray` coerces the array object at the top of the stack into Array
### Summary
def ==(other)
def ==(other) other.is_a?(SplatArray) && other.flag == flag end
def call(vm)
def call(vm) value = vm.pop vm.push( if Array === value value.instance_of?(Array) ? value.dup : Array[*value] elsif value.nil? value.to_a else if value.respond_to?(:to_a, true) result = value.to_a if result.nil? [value] elsif !result.is_a?(Array) raise TypeError, "expected to_a to return an Array" end else [value] end end ) end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { flag: flag } end
def disasm(fmt)
def disasm(fmt) fmt.instruction("splatarray", [fmt.object(flag)]) end
def initialize(flag)
def initialize(flag) @flag = flag end
def length
def length 2 end
def pops
def pops 1 end
def pushes
def pushes 1 end
def to_a(_iseq)
def to_a(_iseq) [:splatarray, flag] end