Class: SyntaxTree::YARV::OptStrUMinus
Overview
Summary
opt_str_uminus pushes a frozen known string value with no interpolation
onto the stack. If the method gets overridden, this will fall back to a
send.
Usage
-"string"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #canonical, #falls_through?, #leaves?, #pops, #side_effects?
Constructor Details
#initialize(object, calldata) ⇒ OptStrUMinus
Returns a new instance of OptStrUMinus.
4393
4394
4395
4396
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4393
def initialize(object, calldata)
@object = object
@calldata = calldata
end
|
Instance Attribute Details
#calldata ⇒ Object
Returns the value of attribute calldata.
4391
4392
4393
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4391
def calldata
@calldata
end
|
#object ⇒ Object
Returns the value of attribute object.
4391
4392
4393
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4391
def object
@object
end
|
Instance Method Details
#==(other) ⇒ Object
4413
4414
4415
4416
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4413
def ==(other)
other.is_a?(OptStrUMinus) && other.object == object &&
other.calldata == calldata
end
|
#call(vm) ⇒ Object
4426
4427
4428
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4426
def call(vm)
vm.push(-object)
end
|
#deconstruct_keys(_keys) ⇒ Object
4409
4410
4411
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4409
def deconstruct_keys(_keys)
{ object: object, calldata: calldata }
end
|
#disasm(fmt) ⇒ Object
4398
4399
4400
4401
4402
4403
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4398
def disasm(fmt)
fmt.instruction(
"opt_str_uminus",
[fmt.object(object), fmt.calldata(calldata)]
)
end
|
#length ⇒ Object
4418
4419
4420
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4418
def length
3
end
|
#pushes ⇒ Object
4422
4423
4424
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4422
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
4405
4406
4407
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 4405
def to_a(_iseq)
[:opt_str_uminus, object, calldata.to_h]
end
|