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.
1253
1254
1255
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1253
def initialize(object)
@object = object
end
|
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
1251
1252
1253
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1251
def object
@object
end
|
Instance Method Details
#==(other) ⇒ Object
1269
1270
1271
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1269
def ==(other)
other.is_a?(DupArray) && other.object == object
end
|
#call(vm) ⇒ Object
1281
1282
1283
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1281
def call(vm)
vm.push(object.dup)
end
|
#deconstruct_keys(_keys) ⇒ Object
1265
1266
1267
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1265
def deconstruct_keys(_keys)
{ object: object }
end
|
#disasm(fmt) ⇒ Object
1257
1258
1259
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1257
def disasm(fmt)
fmt.instruction("duparray", [fmt.object(object)])
end
|
#length ⇒ Object
1273
1274
1275
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1273
def length
2
end
|
#pushes ⇒ Object
1277
1278
1279
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1277
def pushes
1
end
|
#to_a(_iseq) ⇒ Object
1261
1262
1263
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 1261
def to_a(_iseq)
[:duparray, object]
end
|