Class: Apricot::TopLevelScope

Inherits:
Object
  • Object
show all
Includes:
StorageScope
Defined in:
lib/apricot/scopes.rb

Instance Method Summary collapse

Methods included from StorageScope

#local_count, #local_names, #next_slot, #store_new_local, #variable_names

Instance Method Details

#find_recur_targetObject

A (recur) is looking for a recursion target. Since this is the top level, which has no parent, the lookup has failed.



41
42
43
# File 'lib/apricot/scopes.rb', line 41

def find_recur_target
  nil
end

#find_var(name, depth = nil) ⇒ Object

A nested scope is looking up a variable. There are no local variables at the top level, so look up the variable on the current namespace.



34
35
36
37
# File 'lib/apricot/scopes.rb', line 34

def find_var(name, depth = nil)
  # Ignore depth, it has no bearing on namespace lookups.
  QualifiedReference.new(name, Apricot.current_namespace)
end