Class: SyntaxTree::YARV::NewArrayKwSplat
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::NewArrayKwSplat
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
newarraykwsplat is a specialized version of newarray that takes a ** splat argument. It pops number values off the stack and pushes the array onto the stack.
### Usage
~~~ruby
- “string”, **{ foo: “bar” }
-
~~~
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(number) ⇒ NewArrayKwSplat
constructor
A new instance of NewArrayKwSplat.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(number) ⇒ NewArrayKwSplat
Returns a new instance of NewArrayKwSplat.
2234 2235 2236 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2234 def initialize(number) @number = number end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
2232 2233 2234 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2232 def number @number end |
Instance Method Details
#call(vm) ⇒ Object
2262 2263 2264 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2262 def call(vm) vm.push(vm.pop(number)) end |
#canonical ⇒ Object
2258 2259 2260 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2258 def canonical self end |
#disasm(fmt) ⇒ Object
2238 2239 2240 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2238 def disasm(fmt) fmt.instruction("newarraykwsplat", [fmt.object(number)]) end |
#length ⇒ Object
2246 2247 2248 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2246 def length 2 end |
#pops ⇒ Object
2250 2251 2252 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2250 def pops number end |
#pushes ⇒ Object
2254 2255 2256 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2254 def pushes 1 end |
#to_a(_iseq) ⇒ Object
2242 2243 2244 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2242 def to_a(_iseq) [:newarraykwsplat, number] end |