Class: SyntaxTree::YARV::SetSpecial
Overview
Summary
setspecial pops a value off the top of the stack and sets a special
local variable to that value. The special local variable is determined by
the key given as its only argument.
Usage
baz if (foo == 1) .. (bar == 1)
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Instruction
#branch_targets, #canonical, #falls_through?, #leaves?, #pushes, #side_effects?
Constructor Details
Returns a new instance of SetSpecial.
5427
5428
5429
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5427
def initialize(key)
@key = key
end
|
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
5425
5426
5427
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5425
def key
@key
end
|
Instance Method Details
#==(other) ⇒ Object
5443
5444
5445
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5443
def ==(other)
other.is_a?(SetSpecial) && other.key == key
end
|
#deconstruct_keys(_keys) ⇒ Object
5439
5440
5441
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5439
def deconstruct_keys(_keys)
{ key: key }
end
|
#disasm(fmt) ⇒ Object
5431
5432
5433
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5431
def disasm(fmt)
fmt.instruction("setspecial", [fmt.object(key)])
end
|
#length ⇒ Object
5447
5448
5449
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5447
def length
2
end
|
#pops ⇒ Object
5451
5452
5453
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5451
def pops
1
end
|
#to_a(_iseq) ⇒ Object
5435
5436
5437
|
# File 'lib/syntax_tree/yarv/instructions.rb', line 5435
def to_a(_iseq)
[:setspecial, key]
end
|