Class: Apricot::LocalReference
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#slot ⇒ Object
readonly
Returns the value of attribute slot.
Instance Method Summary collapse
- #bytecode(g) ⇒ Object
-
#initialize(slot, depth = 0) ⇒ LocalReference
constructor
A new instance of LocalReference.
Constructor Details
#initialize(slot, depth = 0) ⇒ LocalReference
Returns a new instance of LocalReference.
5 6 7 8 |
# File 'lib/apricot/variables.rb', line 5 def initialize(slot, depth = 0) @slot = slot @depth = depth end |
Instance Attribute Details
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
3 4 5 |
# File 'lib/apricot/variables.rb', line 3 def depth @depth end |
#slot ⇒ Object (readonly)
Returns the value of attribute slot.
3 4 5 |
# File 'lib/apricot/variables.rb', line 3 def slot @slot end |
Instance Method Details
#bytecode(g) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/apricot/variables.rb', line 10 def bytecode(g) if @depth == 0 g.push_local @slot else g.push_local_depth @depth, @slot end end |