Module: Apricot::StorageScope
- Included in:
- OverloadScope, TopLevelScope
- Defined in:
- lib/apricot/scopes.rb
Overview
This is a scope with real local variable storage, i.e. it is part of a block of code like a fn or the top level program. Let scopes do not have storage and must ask for storage from one of these.
Instance Method Summary collapse
- #local_count ⇒ Object
- #local_names ⇒ Object
- #next_slot ⇒ Object
- #store_new_local(name) ⇒ Object
- #variable_names ⇒ Object
Instance Method Details
#local_count ⇒ Object
20 21 22 |
# File 'lib/apricot/scopes.rb', line 20 def local_count variable_names.size end |
#local_names ⇒ Object
24 25 26 |
# File 'lib/apricot/scopes.rb', line 24 def local_names variable_names end |
#next_slot ⇒ Object
16 17 18 |
# File 'lib/apricot/scopes.rb', line 16 def next_slot variable_names.size end |
#store_new_local(name) ⇒ Object
10 11 12 13 14 |
# File 'lib/apricot/scopes.rb', line 10 def store_new_local(name) slot = next_slot variable_names << name slot end |
#variable_names ⇒ Object
6 7 8 |
# File 'lib/apricot/scopes.rb', line 6 def variable_names @variable_names ||= [] end |