Class: SyntaxTree::YARV::PutChilledString
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
"foo"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #canonical, #falls_through?, #leaves?, #pops, #side_effects?
Constructor Details
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
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
|