Class: SyntaxTree::YARV::PutString
- Inherits:
-
Instruction
- Object
- Instruction
- 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
- #==(other) ⇒ Object
- #call(vm) ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
- #disasm(fmt) ⇒ Object
-
#initialize(object) ⇒ PutString
constructor
A new instance of PutString.
- #length ⇒ Object
- #pushes ⇒ Object
- #to_a(_iseq) ⇒ Object
Methods inherited from Instruction
#branch_targets, #canonical, #falls_through?, #leaves?, #pops, #side_effects?
Constructor Details
#initialize(object) ⇒ PutString
Returns a new instance of PutString.
4922 4923 4924 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4922 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
4920 4921 4922 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4920 def object @object end |
Instance Method Details
#==(other) ⇒ Object
4938 4939 4940 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4938 def ==(other) other.is_a?(PutString) && other.object == object end |
#call(vm) ⇒ Object
4950 4951 4952 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4950 def call(vm) vm.push(object.dup) end |
#deconstruct_keys(_keys) ⇒ Object
4934 4935 4936 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4934 def deconstruct_keys(_keys) { object: object } end |
#disasm(fmt) ⇒ Object
4926 4927 4928 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4926 def disasm(fmt) fmt.instruction("putstring", [fmt.object(object)]) end |
#length ⇒ Object
4942 4943 4944 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4942 def length 2 end |
#pushes ⇒ Object
4946 4947 4948 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4946 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4930 4931 4932 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4930 def to_a(_iseq) [:putstring, object] end |