|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Context
A context represents a stack of scopes used for looking up types, methods,
and variables. To push a new scope call one of the push*
methods to return a new context. The old context may still be used
and may be accessed directly through a call to pop()
.
While the stack of scopes is treated functionally, each individual
scope is updated in place. Names added to the context are added
in the current scope.
Method Summary | |
---|---|
void |
addMethod(MethodInstance mi)
Add a method to the current scope. |
void |
addNamed(Named t)
Add a named type object to the current scope. |
void |
addVariable(VarInstance vi)
Add a variable to the current scope. |
ClassType |
currentClass()
Return the innermost class in scope. |
ParsedClassType |
currentClassScope()
Return the innermost class in scope. |
CodeInstance |
currentCode()
Return the innermost method or constructor in scope. |
FieldInstance |
findField(java.lang.String name)
Looks up a field in the current scope. |
ClassType |
findFieldScope(java.lang.String name)
Finds the class which added a field to the scope. |
LocalInstance |
findLocal(java.lang.String name)
Looks up a local variable in the current scope. |
MethodInstance |
findMethod(java.lang.String name,
java.util.List formalTypes)
Looks up a method in the current scope. |
ClassType |
findMethodScope(java.lang.String name)
Finds the class which added a method to the scope. |
VarInstance |
findVariable(java.lang.String name)
Looks up a local variable or field in the current scope. |
VarInstance |
findVariableSilent(java.lang.String name)
Looks up a local variable or field in the current scope. |
ImportTable |
importTable()
Get import table currently in scope. |
boolean |
inCode()
Return whether innermost non-block scope is a code scope. |
boolean |
inStaticContext()
Returns whether the current context is a static context. |
boolean |
isLocal(java.lang.String name)
Returns whether the symbol is defined within the current method. |
Resolver |
outerResolver()
Get the outer-most resolver for the source file currently in scope. |
Package |
package_()
The current package, or null if not in a package. |
Context |
pop()
Pop the context. |
Context |
pushBlock()
Enter the scope of a block. |
Context |
pushClass(ParsedClassType scope,
ClassType type)
Enter the scope of a class. |
Context |
pushCode(CodeInstance f)
Enter the scope of a method or constructor. |
Context |
pushSource(ImportTable it)
Enter the scope of a source file. |
Context |
pushStatic()
Enter a static scope. |
TypeSystem |
typeSystem()
The type system. |
Methods inherited from interface polyglot.types.Resolver |
---|
find |
Methods inherited from interface polyglot.util.Copy |
---|
copy |
Method Detail |
---|
TypeSystem typeSystem()
void addVariable(VarInstance vi)
void addMethod(MethodInstance mi)
void addNamed(Named t)
MethodInstance findMethod(java.lang.String name, java.util.List formalTypes) throws SemanticException
formalTypes
- A list of Type
.
SemanticException
Type
VarInstance findVariable(java.lang.String name) throws SemanticException
SemanticException
VarInstance findVariableSilent(java.lang.String name)
LocalInstance findLocal(java.lang.String name) throws SemanticException
SemanticException
FieldInstance findField(java.lang.String name) throws SemanticException
SemanticException
ClassType findFieldScope(java.lang.String name) throws SemanticException
findField(name).container()
.
SemanticException
ClassType findMethodScope(java.lang.String name) throws SemanticException
findMethod(name).container()
.
SemanticException
ImportTable importTable()
Resolver outerResolver()
Context pushSource(ImportTable it)
Context pushClass(ParsedClassType scope, ClassType type)
Context pushCode(CodeInstance f)
Context pushBlock()
Context pushStatic()
Context pop()
boolean inCode()
boolean isLocal(java.lang.String name)
boolean inStaticContext()
ClassType currentClass()
ParsedClassType currentClassScope()
CodeInstance currentCode()
Package package_()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |