public class Scope extends Object
This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
Modifier and Type | Class and Description |
---|---|
static class |
Scope.CompoundScope
A class scope adds capabilities to keep track of changes in related
class scopes - this allows client to realize whether a class scope
has changed, either directly (because a new member has been added/removed
to this scope) or indirectly (i.e.
|
static class |
Scope.DelegatedScope
An empty scope, into which you can't place anything.
|
static class |
Scope.Entry
A class for scope entries.
|
static class |
Scope.ErrorScope
An error scope, for which the owner should be an error symbol.
|
static class |
Scope.ImportScope |
static interface |
Scope.ScopeListener |
static class |
Scope.StarImportScope |
Modifier and Type | Field and Description |
---|---|
Scope.Entry |
elems
A linear list that also contains all entries in
reverse order of appearance (i.e later entries are pushed on top).
|
static Scope |
emptyScope
A value for the empty scope.
|
Scope |
next
Next enclosing scope (with whom this scope may share a hashtable)
|
Symbol |
owner
The scope's owner.
|
Constructor and Description |
---|
Scope(Symbol owner)
Construct a new scope, within scope next, with given owner,
using a fresh table of length INITIAL_SIZE.
|
Modifier and Type | Method and Description |
---|---|
void |
addScopeListener(Scope.ScopeListener sl) |
boolean |
anyMatch(Filter<Symbol> sf) |
Scope |
dup()
Construct a fresh scope within this scope, with same owner,
which shares its table with the outer scope.
|
Scope |
dup(Symbol newOwner)
Construct a fresh scope within this scope, with new owner,
which shares its table with the outer scope.
|
Scope |
dupUnshared()
Construct a fresh scope within this scope, with same owner,
with a new hash table, whose contents initially are those of
the table of its outer scope.
|
void |
enter(Symbol sym)
Enter symbol sym in this scope.
|
void |
enter(Symbol sym,
Scope s) |
void |
enter(Symbol sym,
Scope s,
Scope origin,
boolean staticallyImported)
Enter symbol sym in this scope, but mark that it comes from
given scope `s' accessed through `origin'.
|
void |
enterIfAbsent(Symbol sym)
Enter symbol sym in this scope if not already there.
|
Iterable<Symbol> |
getElements() |
Iterable<Symbol> |
getElements(Filter<Symbol> sf) |
Iterable<Symbol> |
getElementsByName(Name name) |
Iterable<Symbol> |
getElementsByName(Name name,
Filter<Symbol> sf) |
boolean |
includes(Symbol c)
Given a class, is there already a class with same fully
qualified name in this (import) scope?
|
Scope |
leave()
Remove all entries of this scope from its table, if shared
with next.
|
Scope.Entry |
lookup(Name name)
Return the entry associated with given name, starting in
this scope and proceeding outwards.
|
Scope.Entry |
lookup(Name name,
Filter<Symbol> sf) |
void |
remove(Symbol sym)
Remove symbol from this scope.
|
String |
toString() |
public Scope next
public Symbol owner
public Scope.Entry elems
public static final Scope emptyScope
public Scope(Symbol owner)
public Scope dup()
public Scope dup(Symbol newOwner)
public Scope dupUnshared()
public Scope leave()
public void enter(Symbol sym)
public void enter(Symbol sym, Scope s, Scope origin, boolean staticallyImported)
public void addScopeListener(Scope.ScopeListener sl)
public void remove(Symbol sym)
public void enterIfAbsent(Symbol sym)
public boolean includes(Symbol c)
public Scope.Entry lookup(Name name)
public Scope.Entry lookup(Name name, Filter<Symbol> sf)
Copyright © 2017 earcam. All rights reserved.