|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.mjc.CContext
org.multijava.mjc.CCompilationUnitContext
This class represents the context for a compilation unit during checking passes (checkInterface, checkInitializers, typecheck).
CContextType| Field Summary | |
private Main |
compiler
|
private CCompilationUnit |
cunit
|
| Fields inherited from class org.multijava.mjc.CContext |
contextNullity, parent |
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
CCompilationUnitContext(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. |
CTypeVariable |
lookupTypeVariable(String ident)
search for type variable that are accessible |
void |
registerGFDecl(String ident,
CGenericFunctionCollection coll)
Registers the declaration of an external generic function in this context. |
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. |
void |
resolveMaybeExtMethodRef(String ident)
Searches for any imported external generic functions. |
| 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 |
| Methods inherited from interface org.multijava.mjc.CContextType |
addFANonNull, addFANonNulls, addFANull, addFANulls, adoptNullityInfo, catchUp, check, check, check, check, createClassContext, createExtMethodContext, createInterfaceContext, declaredOutsideOfLoop, declares, dumpNonNulls, fail, fail, getCMethod, getFANonNulls, getFANulls, initializeField, isBeforeSuperConstructorCall, isFANonNull, isFieldDefinitelyAssigned, isInConstructor, isInInitializer, isInLoop, isPure, isStatic, lookupField, lookupMethod, lookupMethodOrSet, lookupOuterField, mergeNullityInfo, modUtil, removeAllFANullity, removeFANonNull, replaceFieldInfoUpTo |
| Field Detail |
private Main compiler
private CCompilationUnit cunit
| Constructor Detail |
public CCompilationUnitContext(Main compiler,
CCompilationUnit cunit)
| Method Detail |
public CVariableState fieldInfo(int pos)
fieldInfo in interface CCompilationUnitContextTypeUnsupportedOperationException
public CClass lookupClass(String name)
throws UnpositionedError
lookupClass in interface CCompilationUnitContextTypelookupClass in class CContextname - the class name, without qualifiers
UnpositionedError - if search fails
public CTypeVariable lookupTypeVariable(String ident)
throws UnpositionedError
CContextType
lookupTypeVariable in interface CContextTypelookupTypeVariable in class CContextUnpositionedError
public CMethod lookupMethod(String name,
CType[] params,
CClassContextType context)
throws UnpositionedError
lookupMethod in interface CCompilationUnitContextTypelookupMethod in class CContextname - 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 CContextname - 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 CContextUnpositionedError - this error will be positioned soonpublic JLocalVariable lookupLocalVariable(String ident)
lookupLocalVariable in interface CContextTypelookupLocalVariable in class CContextident - the name of the local variable
public JExpression lookupOuterLocalVariable(TokenReference ref,
String ident)
lookupOuterLocalVariable in interface CCompilationUnitContextTypelookupOuterLocalVariable in class CContextref - 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 CContextident - 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 CContextident - the name of the generic function to search for
public void registerGFDecl(String ident,
CGenericFunctionCollection coll)
registerGFDecl in interface CContextTyperegisterGFDecl in class CContextpublic void registerVisibleMethod(CMethod method)
registerVisibleMethod in interface CCompilationUnitContextTyperegisterVisibleMethod in class CContextpublic void registerVisibleType(CType type)
registerVisibleType in interface CCompilationUnitContextTyperegisterVisibleType in class CContextpublic CContextType getParentContext()
getParentContext in interface CCompilationUnitContextTypegetParentContext in class CContextpublic CClassContextType getClassContext()
getClassContext in interface CCompilationUnitContextTypegetClassContext in class CContextpublic CMethodContextType getMethodContext()
getMethodContext in interface CCompilationUnitContextTypegetMethodContext in class CContextpublic CCompilationUnitContextType getCompilationUnit()
CContextType
getCompilationUnit in interface CCompilationUnitContextTypegetCompilationUnit in class CContextpublic CFlowControlContextType getFlowControlContext()
getFlowControlContext in interface CCompilationUnitContextTypegetFlowControlContext in class CContextpublic 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 CContextCMemberHost, i.e., this.cunit public CBinaryClassContext createBinaryClassContext(CBinaryClass clazz)
createBinaryClassContext in interface CCompilationUnitContextTypepublic void reportTrouble(Exception trouble)
reportTrouble in interface CCompilationUnitContextTypereportTrouble in class CContexttrouble - the trouble public Main getCompiler()
getCompiler in interface CCompilationUnitContextTypegetCompiler in class CContextpublic void classToGenerate(CSourceClass clazz)
classToGenerate in interface CCompilationUnitContextTypeclassToGenerate in class CContextpublic 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 MJMathMode arithmeticMode()
CContextType
arithmeticMode in interface CContextTypearithmeticMode in class CContext
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||