|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.jmlspecs.checker.JmlContext
org.jmlspecs.checker.JmlCompilationUnitContext
This class represents the context for a compilation unit during checking passes (checkInterface, checkInitializers, typecheck).
CContextType| Field Summary | |
private Main.PTMode |
mode
|
| Fields inherited from class org.jmlspecs.checker.JmlContext |
cunit, delegee, parent |
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
(package private) |
JmlCompilationUnitContext(Main compiler,
CCompilationUnit cunit)
Construct a compilation unit context. |
| Method Summary | |
MJMathMode |
arithmeticMode()
Indicates the integral arithmetic mode that should be used. |
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 |
JLocalVariable |
lookupLocalVariable(String ident)
Finds the variable with the given identifier in this context. |
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. |
Main.PTMode |
mode()
|
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 a trouble into the list and eats it. |
void |
resolveMaybeExtMethodRef(String ident)
Searches for any imported external generic functions. |
void |
setMode(Main.PTMode m)
|
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private Main.PTMode mode
| Constructor Detail |
JmlCompilationUnitContext(Main compiler,
CCompilationUnit cunit)
requires compiler != null && cunit != null; ensures delegee != null && (delegee instanceof CCompilationUnitContext);
| Method Detail |
public CVariableState fieldInfo(int pos)
fieldInfo in interface CCompilationUnitContextTypeUnsupportedOperationException
public CClass lookupClass(String name)
throws UnpositionedError
lookupClass in interface CCompilationUnitContextTypelookupClass in class JmlContextname - the class name, without qualifiers
UnpositionedError - if search fails
public CMethod lookupMethod(String name,
CType[] params,
CClassContextType context)
throws UnpositionedError
lookupMethod in interface CCompilationUnitContextTypelookupMethod in class JmlContextname - 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 CCompilationUnitContextTypelookupMethodOrSet in class JmlContextname - 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 CCompilationUnitContextTypelookupField in class JmlContextUnpositionedError - this error will be positioned soonpublic JLocalVariable lookupLocalVariable(String ident)
lookupLocalVariable in interface CContextTypelookupLocalVariable in class JmlContextident - the name of the local variable
public JExpression lookupOuterLocalVariable(TokenReference ref,
String ident)
lookupOuterLocalVariable in interface CCompilationUnitContextTypelookupOuterLocalVariable in class JmlContextref - 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 CCompilationUnitContextTypelookupOuterField in class JmlContextident - 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 CCompilationUnitContextTyperesolveMaybeExtMethodRef in class JmlContextident - the name of the generic function to search forpublic void registerVisibleMethod(CMethod method)
registerVisibleMethod in interface CCompilationUnitContextTyperegisterVisibleMethod in class JmlContextpublic void registerVisibleType(CType type)
registerVisibleType in interface CCompilationUnitContextTyperegisterVisibleType in class JmlContextpublic CContextType getParentContext()
getParentContext in interface CCompilationUnitContextTypegetParentContext in class JmlContextpublic CClassContextType getClassContext()
getClassContext in interface CCompilationUnitContextTypegetClassContext in class JmlContextpublic CMethodContextType getMethodContext()
getMethodContext in interface CCompilationUnitContextTypegetMethodContext in class JmlContextpublic CCompilationUnitContextType getCompilationUnit()
CContextType
getCompilationUnit in interface CCompilationUnitContextTypegetCompilationUnit in class JmlContextpublic CFlowControlContextType getFlowControlContext()
getFlowControlContext in interface CCompilationUnitContextTypegetFlowControlContext in class JmlContextpublic 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 CCompilationUnitContextTypefindNearestHost in class JmlContextCMemberHost, i.e., this.cunit public CBinaryClassContext createBinaryClassContext(CBinaryClass clazz)
createBinaryClassContext in interface CCompilationUnitContextTypepublic void reportTrouble(Exception trouble)
reportTrouble in interface CCompilationUnitContextTypereportTrouble in class JmlContexttrouble - the troublepublic Main getCompiler()
getCompiler in interface CCompilationUnitContextTypegetCompiler in class JmlContextpublic void classToGenerate(CSourceClass clazz)
classToGenerate in interface CCompilationUnitContextTypeclassToGenerate in class JmlContextpublic boolean equals(Object o)
equals in interface CCompilationUnitContextTypeequals in class Objecto - the object to compare against
o is another
CCompilationUnitContextType formed around an
identical (i.e., ==) CCompilationUnitpublic int hashCode()
this.cunit.hashCode().
hashCode in interface CCompilationUnitContextTypehashCode in class Objectpublic Main.PTMode mode()
public void setMode(Main.PTMode m)
public MJMathMode arithmeticMode()
CContextType
arithmeticMode in interface CContextTypearithmeticMode in class JmlContext
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||