|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This class represents the context for a compilation unit during checking passes (checkInterface, checkInitializers, typecheck).
CContextType| Method Summary | |
void |
classToGenerate(CSourceClass clazz)
Adds a class to generate |
CBinaryClassContext |
createBinaryClassContext(CBinaryClass clazz)
|
boolean |
equals(Object o)
Indicates whether this is equal to a given object. |
CVariableState |
fieldInfo(int pos)
Fields cannot be declared in the context of a compilation unit (yet), consequently we do not expect to invoke this method on a compilation unit context. |
CMemberHost |
findNearestHost()
Returns the signature of the nearest lexically enclosing context that can host member declarations (i.e., a CClass or a CCompilationUnit). |
CClassContextType |
getClassContext()
getClass |
CCompilationUnitContextType |
getCompilationUnit()
Returns the compilation unit context for this context. |
Main |
getCompiler()
Gets the compiler |
CFlowControlContextType |
getFlowControlContext()
Returns the nearest control flow context (where control flow information is stored.) |
CMethodContextType |
getMethodContext()
getMethod |
CContextType |
getParentContext()
getParentContext |
int |
hashCode()
Returns the hash code for this, equivalent to this.cunit.hashCode(). |
CClass |
lookupClass(String name)
Searches for a class with the given simple name according the procedure in JLS2 6.5.5. |
CFieldAccessor |
lookupField(String ident,
CExpressionContextType context)
searches for a field with the given identifier |
CMethod |
lookupMethod(String name,
CType[] params,
CClassContextType context)
Searches for the most specific method applicable to the given identifier and argument type tuple, in the current context. |
CMethodSet |
lookupMethodOrSet(String name,
CType[] params,
CClassContextType context)
Searches for the most specific method(s) applicable to the given identifier and argument type tuple, in the current context. |
CFieldAccessor |
lookupOuterField(String ident,
CExpressionContextType context)
Searches for a field of the given name in the context surrounding the current lexical contour. |
JExpression |
lookupOuterLocalVariable(TokenReference ref,
String ident)
Finds a local variable with the given name that appears outside the current lexical contour. |
void |
registerVisibleMethod(CMethod method)
Registers that a declaration of the given method occurs within the compilation unit. |
void |
registerVisibleType(CType type)
Registers that a reference to the given type occurs within the compilation unit. |
void |
reportTrouble(Exception trouble)
Adds an trouble into the list and eats it This method should be called after a try catch block after catching exception or directly without exception thrown |
void |
resolveMaybeExtMethodRef(String ident)
Searches for any imported external generic functions. |
| Method Detail |
public CVariableState fieldInfo(int pos)
UnsupportedOperationException
public CClass lookupClass(String name)
throws UnpositionedError
lookupClass in interface CContextTypename - the class name, without qualifiers
UnpositionedError - if search fails
public CMethod lookupMethod(String name,
CType[] params,
CClassContextType context)
throws UnpositionedError
lookupMethod in interface CContextTypename - method nameparams - method parameter typescontext - the context of the class containing
the method call
UnpositionedError - if the result is ambiguous
public CMethodSet lookupMethodOrSet(String name,
CType[] params,
CClassContextType context)
throws UnpositionedError
lookupMethodOrSet in interface CContextTypename - method nameparams - method parameter typescontext - the context of the class containing
the method call
UnpositionedError - if the result is ambiguous
public CFieldAccessor lookupField(String ident,
CExpressionContextType context)
throws UnpositionedError
lookupField in interface CContextTypeUnpositionedError - this error will be positioned soon
public JExpression lookupOuterLocalVariable(TokenReference ref,
String ident)
lookupOuterLocalVariable in interface CContextTyperef - a token reference used to build a new
JOuterLocalVariableExpressionident - the name of the outer variable
public CFieldAccessor lookupOuterField(String ident,
CExpressionContextType context)
throws UnpositionedError
lookupOuterField in interface CContextTypeident - the name of the fieldcontext - the context of the field access
UnpositionedError - this error will be positioned soonpublic void resolveMaybeExtMethodRef(String ident)
resolveMaybeExtMethodRef in interface CContextTypeident - the name of the generic function to search forpublic void registerVisibleMethod(CMethod method)
registerVisibleMethod in interface CContextTypepublic void registerVisibleType(CType type)
registerVisibleType in interface CContextTypepublic CContextType getParentContext()
getParentContext in interface CContextTypepublic CClassContextType getClassContext()
getClassContext in interface CContextTypepublic CMethodContextType getMethodContext()
getMethodContext in interface CContextTypepublic CCompilationUnitContextType getCompilationUnit()
CContextType
getCompilationUnit in interface CContextTypepublic CFlowControlContextType getFlowControlContext()
getFlowControlContext in interface CContextTypepublic CMemberHost findNearestHost()
CClass or a CCompilationUnit). Used
for access checks, this is slightly different than
getHostClass(). The later method returns an
anchor class signature for external methods, which is useful in
code generation and in typechecking external method bodies. On
the other hand, this method returns a
CCompilationUnit for external methods, which is
useful in checking access between two differently named generic
functions declared in the same compilation unit. !FIXME! It
may be possible to eliminate this method and just use
getHostClass now that private external methods are
duplciated in every anchor.
findNearestHost in interface CContextTypeCMemberHost, i.e., this.cunit public CBinaryClassContext createBinaryClassContext(CBinaryClass clazz)
public void reportTrouble(Exception trouble)
reportTrouble in interface CContextTypetrouble - the troublepublic Main getCompiler()
getCompiler in interface CContextTypepublic void classToGenerate(CSourceClass clazz)
classToGenerate in interface CContextTypeclazz - the class to be generatedpublic boolean equals(Object o)
o - the object to compare against
o is another
CCompilationUnitContextType formed around an
identical (i.e., ==) CCompilationUnitpublic int hashCode()
this.cunit.hashCode().
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||