Class: SyntaxTree::YARV::PutString
- Inherits:
-
Object
- Object
- SyntaxTree::YARV::PutString
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
putstring pushes an unfrozen string literal onto the stack.
### Usage
~~~ruby “foo” ~~~
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #call(vm) ⇒ Object
- #canonical ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(object) ⇒ PutString
constructor
A new instance of PutString.
- #length ⇒ Object
- #pops ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Constructor Details
#initialize(object) ⇒ PutString
Returns a new instance of PutString.
4442 4443 4444 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4442 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
4440 4441 4442 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4440 def object @object end |
Instance Method Details
#call(vm) ⇒ Object
4470 4471 4472 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4470 def call(vm) vm.push(object.dup) end |
#canonical ⇒ Object
4466 4467 4468 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4466 def canonical self end |
#disasm(fmt) ⇒ Object
4446 4447 4448 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4446 def disasm(fmt) fmt.instruction("putstring", [fmt.object(object)]) end |
#length ⇒ Object
4454 4455 4456 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4454 def length 2 end |
#pops ⇒ Object
4458 4459 4460 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4458 def pops 0 end |
#pushes ⇒ Object
4462 4463 4464 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4462 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4450 4451 4452 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4450 def to_a(_iseq) [:putstring, object] end |