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
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #deconstruct_keys(_keys) ⇒ 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.
2526 2527 2528 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2526 def initialize(number) @number = number end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
2524 2525 2526 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2524 def number @number end |
Instance Method Details
#==(other) ⇒ Object
2542 2543 2544 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2542 def ==(other) other.is_a?(NewArrayKwSplat) && other.number == number end |
#call(vm) ⇒ Object
2562 2563 2564 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2562 def call(vm) vm.push(vm.pop(number)) end |
#canonical ⇒ Object
2558 2559 2560 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2558 def canonical self end |
#deconstruct_keys(_keys) ⇒ Object
2538 2539 2540 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2538 def deconstruct_keys(_keys) { number: number } end |
#disasm(fmt) ⇒ Object
2530 2531 2532 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2530 def disasm(fmt) fmt.instruction("newarraykwsplat", [fmt.object(number)]) end |
#length ⇒ Object
2546 2547 2548 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2546 def length 2 end |
#pops ⇒ Object
2550 2551 2552 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2550 def pops number end |
#pushes ⇒ Object
2554 2555 2556 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2554 def pushes 1 end |
#to_a(_iseq) ⇒ Object
2534 2535 2536 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 2534 def to_a(_iseq) [:newarraykwsplat, number] end |