Class: SyntaxTree::YARV::PutChilledString
- Inherits:
-
Instruction
- Object
- Instruction
- SyntaxTree::YARV::PutChilledString
- Defined in:
- lib/syntax_tree/yarv/instructions.rb
Overview
### Summary
‘putchilledstring` pushes an unfrozen string literal onto the stack that acts like a frozen string. This is a migration path to frozen string literals as the default in the future.
### 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) ⇒ PutChilledString
constructor
A new instance of PutChilledString.
- #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) ⇒ PutChilledString
Returns a new instance of PutChilledString.
4876 4877 4878 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4876 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
4874 4875 4876 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4874 def object @object end |
Instance Method Details
#==(other) ⇒ Object
4892 4893 4894 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4892 def ==(other) other.is_a?(PutChilledString) && other.object == object end |
#call(vm) ⇒ Object
4904 4905 4906 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4904 def call(vm) vm.push(object.dup) end |
#deconstruct_keys(_keys) ⇒ Object
4888 4889 4890 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4888 def deconstruct_keys(_keys) { object: object } end |
#disasm(fmt) ⇒ Object
4880 4881 4882 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4880 def disasm(fmt) fmt.instruction("putchilledstring", [fmt.object(object)]) end |
#length ⇒ Object
4896 4897 4898 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4896 def length 2 end |
#pushes ⇒ Object
4900 4901 4902 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4900 def pushes 1 end |
#to_a(_iseq) ⇒ Object
4884 4885 4886 |
# File 'lib/syntax_tree/yarv/instructions.rb', line 4884 def to_a(_iseq) [:putchilledstring, object] end |