|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.code.Scope
public class Scope
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.
| Nested Class Summary | |
|---|---|
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
|
| Field Summary | |
|---|---|
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. |
(package private) int |
hashMask
Mask for hash codes, always equal to (table.length - 1). |
private static int |
INITIAL_SIZE
The hash table's initial size. |
Symbol.Level |
level
|
int |
nelems
The number of elements in this scope. |
Scope |
next
Next enclosing scope (with whom this scope may share a hashtable) |
Symbol |
owner
The scope's owner. |
private static Scope.Entry |
sentinel
Every hash bucket is a list of Entry's which ends in sentinel. |
private int |
shared
The number of scopes that share this scope's hash table. |
Scope.Entry[] |
table
A hash table for the scope's entries. |
| Constructor Summary | |
|---|---|
Scope(Scope next,
Symbol owner,
Scope.Entry[] table,
Symbol.Level l)
Construct a new scope, within scope next, with given owner, using given table. |
|
Scope(Symbol owner)
Construct a new scope, within scope next, with given owner, using a fresh table of length INITIAL_SIZE. |
|
Scope(Symbol owner,
int l)
Construct a new scope, within scope next, with given owner, using a fresh table of length INITIAL_SIZE. |
|
Scope(Symbol owner,
Symbol.Level l)
Construct a new scope, within scope next, with given owner, using a fresh table of length INITIAL_SIZE. |
|
| Method Summary | |
|---|---|
private void |
copy(Scope.Entry e)
Copy the given entry and all entries shadowed by it to table |
private void |
dble()
Double size of hash table. |
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)
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. |
java.lang.Iterable<Symbol> |
getElements()
|
int |
getLevel()
|
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. |
(package private) Scope.Entry |
makeEntry(Symbol sym,
Scope.Entry shadowed,
Scope.Entry sibling,
Scope scope,
Scope origin)
|
void |
remove(Symbol sym)
Remove symbol from this scope. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int shared
public Scope next
public Symbol owner
public Scope.Entry[] table
int hashMask
public Scope.Entry elems
public int nelems
public Symbol.Level level
private static final Scope.Entry sentinel
private static final int INITIAL_SIZE
public static final Scope emptyScope
| Constructor Detail |
|---|
Scope(Scope next,
Symbol owner,
Scope.Entry[] table,
Symbol.Level l)
public Scope(Symbol owner,
Symbol.Level l)
public Scope(Symbol owner,
int l)
public Scope(Symbol owner)
| Method Detail |
|---|
public int getLevel()
public Scope dup()
public Scope dup(Symbol newOwner)
public Scope dupUnshared()
public Scope leave()
private void dble()
private void copy(Scope.Entry e)
public void enter(Symbol sym)
public void enter(Symbol sym,
Scope s)
public void enter(Symbol sym,
Scope s,
Scope origin)
Scope.Entry makeEntry(Symbol sym,
Scope.Entry shadowed,
Scope.Entry sibling,
Scope scope,
Scope origin)
public void remove(Symbol sym)
public void enterIfAbsent(Symbol sym)
public boolean includes(Symbol c)
public Scope.Entry lookup(Name name)
public java.lang.Iterable<Symbol> getElements()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||