Class: SyntaxTree::YARV::DupArray
Overview
Summary
duparray dups an Array literal and pushes it onto the stack.
Usage
[true]
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) ⇒ DupArray
Returns a new instance of DupArray.
1306
1307
1308
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1306
def initialize(object)
@object = object
end
|
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
1304
1305
1306
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1304
def object
@object
end
|
Instance Method Details
#==(other) ⇒ Object
1322
1323
1324
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1322
def ==(other)
other.is_a?(DupArray) && other.object == object
end
|
#call(vm) ⇒ Object
1334
1335
1336
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1334
def call(vm)
vm.push(object.dup)
end
|
#deconstruct_keys(_keys) ⇒ Object
1318
1319
1320
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1318
def deconstruct_keys(_keys)
{ object: object }
end
|
#disasm(fmt) ⇒ Object
1310
1311
1312
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1310
def disasm(fmt)
fmt.instruction("duparray", [fmt.object(object)])
end
|
#length ⇒ Object
1326
1327
1328
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1326
def length
2
end
|
#pushes ⇒ Object
1330
1331
1332
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1330
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
1314
1315
1316
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1314
def to_a(_iseq)
[:duparray, object]
end
|