class SyntaxTree::YARV::GetSpecial

### Summary

‘getspecial` pushes the value of a special local variable onto the stack.

### Usage

~~~ruby 1 if (a == 1) .. (b == 2) ~~~

Constants

SVAR_BACKREF
SVAR_FLIPFLOP_START
SVAR_LASTLINE

Attributes

key[R]
type[R]

Public Class Methods

new(key, type) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1990
def initialize(key, type)
  @key = key
  @type = type
end

Public Instance Methods

==(other) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2007
def ==(other)
  other.is_a?(GetSpecial) && other.key == key && other.type == type
end
call(vm) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2019
def call(vm)
  case key
  when SVAR_LASTLINE
    raise NotImplementedError, "getspecial SVAR_LASTLINE"
  when SVAR_BACKREF
    raise NotImplementedError, "getspecial SVAR_BACKREF"
  when SVAR_FLIPFLOP_START
    vm.frame_svar.svars[SVAR_FLIPFLOP_START]
  end
end
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2003
def deconstruct_keys(_keys)
  { key: key, type: type }
end
disasm(fmt) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1995
def disasm(fmt)
  fmt.instruction("getspecial", [fmt.object(key), fmt.object(type)])
end
length() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2011
def length
  3
end
pushes() click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 2015
def pushes
  1
end
to_a(_iseq) click to toggle source
# File lib/syntax_tree/yarv/instructions.rb, line 1999
def to_a(_iseq)
  [:getspecial, key, type]
end