| java.lang.Object com.sun.tools.javac.code.Scope
Scope | public class Scope (Code) | | A scope represents an area of visibility in a Java program. The
Scope class is a container for symbols which provides
efficient access to symbols given their names. Scopes are implemented
as hash tables. Scopes can be nested; the next field of a scope points
to its next outer scope. Nested scopes can share their hash tables.
This is NOT part of any API supported by Sun Microsystems. 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.
|
Inner Class :public static class Entry | |
Inner Class :public static class ImportScope extends Scope | |
Inner Class :public static class DelegatedScope extends Scope | |
Inner Class :public static class ErrorScope extends Scope | |
Field Summary | |
public Entry | elems A linear list that also contains all entries in
reverse order of appearance (i.e later entries are pushed on top). | final public static Scope | emptyScope A value for the empty scope. | int | hashMask Mask for hash codes, always equal to (table.length - 1). | public int | nelems The number of elements in this scope. | public Scope | next | public Symbol | owner The scope's owner. | public Entry[] | table A hash table for the scope's entries. |
Constructor Summary | |
| Scope(Scope next, Symbol owner, Entry[] table) Construct a new scope, within scope next, with given owner, using
given table. | public | Scope(Symbol owner) Construct a new scope, within scope next, with given owner,
using a fresh table of length INITIAL_SIZE. |
Method Summary | |
public Scope | dup() Construct a fresh scope within this scope, with same owner,
which shares its table with the outer scope. | public Scope | dup(Symbol newOwner) Construct a fresh scope within this scope, with new owner,
which shares its table with the outer scope. | public 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. | public void | enter(Symbol sym) Enter symbol sym in this scope. | public void | enter(Symbol sym, Scope s) | public void | enter(Symbol sym, Scope s, Scope origin) Enter symbol sym in this scope, but mark that it comes from
given scope `s' accessed through `origin'. | public void | enterIfAbsent(Symbol sym) Enter symbol sym in this scope if not already there. | public Iterable<Symbol> | getElements() | public boolean | includes(Symbol c) | public Scope | leave() Remove all entries of this scope from its table, if shared
with next. | public Entry | lookup(Name name) Return the entry associated with given name, starting in
this scope and proceeding outwards. | Entry | makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin) | public void | remove(Symbol sym) Remove symbol from this scope. | public String | toString() |
elems | public Entry elems(Code) | | A linear list that also contains all entries in
reverse order of appearance (i.e later entries are pushed on top).
|
emptyScope | final public static Scope emptyScope(Code) | | A value for the empty scope.
|
hashMask | int hashMask(Code) | | Mask for hash codes, always equal to (table.length - 1).
|
nelems | public int nelems(Code) | | The number of elements in this scope.
|
next | public Scope next(Code) | | Next enclosing scope (with whom this scope may share a hashtable)
|
table | public Entry[] table(Code) | | A hash table for the scope's entries.
|
Scope | Scope(Scope next, Symbol owner, Entry[] table)(Code) | | Construct a new scope, within scope next, with given owner, using
given table. The table's length must be an exponent of 2.
|
Scope | public Scope(Symbol owner)(Code) | | Construct a new scope, within scope next, with given owner,
using a fresh table of length INITIAL_SIZE.
|
dup | public Scope dup()(Code) | | Construct a fresh scope within this scope, with same owner,
which shares its table with the outer scope. Used in connection with
method leave if scope access is stack-like in order to avoid allocation
of fresh tables.
|
dup | public Scope dup(Symbol newOwner)(Code) | | Construct a fresh scope within this scope, with new owner,
which shares its table with the outer scope. Used in connection with
method leave if scope access is stack-like in order to avoid allocation
of fresh tables.
|
dupUnshared | public Scope dupUnshared()(Code) | | 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.
|
enter | public void enter(Symbol sym)(Code) | | Enter symbol sym in this scope.
|
enter | public void enter(Symbol sym, Scope s, Scope origin)(Code) | | Enter symbol sym in this scope, but mark that it comes from
given scope `s' accessed through `origin'. The last two
arguments are only used in import scopes.
|
enterIfAbsent | public void enterIfAbsent(Symbol sym)(Code) | | Enter symbol sym in this scope if not already there.
|
includes | public boolean includes(Symbol c)(Code) | | Given a class, is there already a class with same fully
qualified name in this (import) scope?
|
leave | public Scope leave()(Code) | | Remove all entries of this scope from its table, if shared
with next.
|
lookup | public Entry lookup(Name name)(Code) | | Return the entry associated with given name, starting in
this scope and proceeding outwards. If no entry was found,
return the sentinel, which is characterized by having a null in
both its scope and sym fields, whereas both fields are non-null
for regular entries.
|
remove | public void remove(Symbol sym)(Code) | | Remove symbol from this scope. Used when an inner class
attribute tells us that the class isn't a package member.
|
|
|