Class: CodeTools::Compiler::NestedLocalReference

Inherits:
Object
  • Object
show all
Defined in:
lib/rubinius/code/compiler/locals.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slot, depth = 0) ⇒ NestedLocalReference

Returns a new instance of NestedLocalReference.



100
101
102
103
# File 'lib/rubinius/code/compiler/locals.rb', line 100

def initialize(slot, depth=0)
  @slot = slot
  @depth = depth
end

Instance Attribute Details

#depthObject

Returns the value of attribute depth.



97
98
99
# File 'lib/rubinius/code/compiler/locals.rb', line 97

def depth
  @depth
end

#slotObject (readonly)

Returns the value of attribute slot.



98
99
100
# File 'lib/rubinius/code/compiler/locals.rb', line 98

def slot
  @slot
end

Instance Method Details

#get_bytecode(g) ⇒ Object



105
106
107
108
109
110
111
# File 'lib/rubinius/code/compiler/locals.rb', line 105

def get_bytecode(g)
  if @depth == 0
    g.push_local @slot
  else
    g.push_local_depth @depth, @slot
  end
end

#set_bytecode(g) ⇒ Object



113
114
115
116
117
118
119
# File 'lib/rubinius/code/compiler/locals.rb', line 113

def set_bytecode(g)
  if @depth == 0
    g.set_local @slot
  else
    g.set_local_depth @depth, @slot
  end
end