|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This class represents the context for a class during checking passes (checkInterface, checkInitializers, typecheck).
CContextType| Method Summary | |
void |
addInitializer()
Add an initializer to this context |
void |
checkingComplete(JTypeDeclarationType decl,
CVariableInfoTable staticC,
CVariableInfoTable instanceC,
CVariableInfoTable[] constructorsC)
Verifies that all final fields are initialized and all abstract methods are appropriately implemented. |
CConstructorContextType |
createConstructorContext(CMethod self)
|
CInitializerContextType |
createInitializerContext(CMethod self)
|
CMethodContextType |
createMethodContext(CMethod self)
|
CVariableInfoTable |
fieldInfo()
Returns the fieldInfo table. |
CVariableInfoTable |
fieldInfoTable()
Returns the current field information for the most recently checked member of this 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()
getClassContext |
CClass |
getHostClass()
Returns the CClass representing the signature of the class containing this context. |
CClass |
getOwnerClass()
Returns the CClass representing the signature of the class that is the logical owner of this context. |
boolean |
hasInitializer()
Returns true if this class need initializers |
void |
initializeField(VariableDescriptor varDesc)
Marks the field with the given descriptor as definitely assigned to in this context. |
boolean |
isFieldDefinitelyAssigned(int pos)
Indicates whether the field in the given position is definitely assigned to in this context. |
CClass |
lookupClass(java.lang.String name)
Searches for a class with the given simple name according the procedure in JLS2 6.5.5. |
CFieldAccessor |
lookupField(java.lang.String ident,
CExpressionContextType context)
lookupField |
CMethod |
lookupMethod(java.lang.String ident,
CType[] params,
CClassContextType context)
Searches for the most specific method when no receiver is explicit at the call site. |
CMethodSet |
lookupMethodOrSet(java.lang.String ident,
CType[] params,
CClassContextType context)
Searches for the most specific method(s) when no receiver is explicit at the call site. |
CFieldAccessor |
lookupOuterField(java.lang.String ident,
CExpressionContextType context)
Searches for a field of the given name in the context surrounding the current lexical contour. |
JExpression |
lookupOuterLocalVariable(TokenReference ref,
java.lang.String ident)
Finds a local variable with the given name that appears outside the current lexical contour. |
CTypeVariable |
lookupTypeVariable(java.lang.String ident)
search for the type variable that are accessible |
void |
markAllFieldsAsInitialized()
|
void |
registerVisibleType(CType type)
Registers with the surrounding context that a reference to the given type occurs in this context. |
void |
replaceFieldInfoUpTo(int pos,
CVariableInfoTable replacement)
Replaces the local field info for fields in positions 0 up to pos with the info in replacement. |
void |
resolveMaybeExtMethodRef(java.lang.String ident)
Searches for any imported or private external generic functions. |
void |
setFieldInfoTable(CVariableInfoTable fieldInfo)
Sets the field information for this to match that given by fieldInfo. |
| Methods inherited from interface org.multijava.mjc.CContextType |
arithmeticMode, catchUp, check, check, check, check, classToGenerate, createClassContext, createExtMethodContext, createInterfaceContext, declaredOutsideOfLoop, declares, fail, fail, getCMethod, getCompilationUnit, getCompiler, getFlowControlContext, getMethodContext, getParentContext, isBeforeSuperConstructorCall, isInConstructor, isInInitializer, isInLoop, isPure, isStatic, lookupField, lookupLocalVariable, lookupMethod, lookupMethodOrSet, lookupOuterField, modUtil, registerGFDecl, registerVisibleMethod, reportTrouble |
| Method Detail |
public void checkingComplete(JTypeDeclarationType decl,
CVariableInfoTable staticC,
CVariableInfoTable instanceC,
CVariableInfoTable[] constructorsC)
throws UnpositionedError
UnpositionedError - if any checks fail public CMethodContextType createMethodContext(CMethod self)
public CConstructorContextType createConstructorContext(CMethod self)
public CInitializerContextType createInitializerContext(CMethod self)
public void addInitializer()
public boolean hasInitializer()
public CVariableInfoTable fieldInfo()
public void replaceFieldInfoUpTo(int pos,
CVariableInfoTable replacement)
pos with the info in replacement.
replaceFieldInfoUpTo in interface CContextTypepublic void initializeField(VariableDescriptor varDesc)
initializeField in interface CContextTypepublic boolean isFieldDefinitelyAssigned(int pos)
isFieldDefinitelyAssigned in interface CContextTypepublic CVariableInfoTable fieldInfoTable()
typecheck method. That method mutates this
context to include the variable information extracted from the
statement being checked. Upon return from the
typecheck the caller calls
fieldInfoTable to extract the information. This
is kludgey and one wonders why the typecheck
methods doesn't just return the CVariableInfoTable
instance. !FIXME!
public void setFieldInfoTable(CVariableInfoTable fieldInfo)
fieldInfo. Called before typechecking
constructors with the argument equal to the field assignment
information after checking initializers.
public void markAllFieldsAsInitialized()
public CClass lookupClass(java.lang.String name)
throws UnpositionedError
lookupClass in interface CContextTypename - the class name, without qualifiers
UnpositionedError - if search fails
public CTypeVariable lookupTypeVariable(java.lang.String ident)
throws UnpositionedError
lookupTypeVariable in interface CContextTypeUnpositionedError
public CMethod lookupMethod(java.lang.String ident,
CType[] params,
CClassContextType context)
throws UnpositionedError
lookupMethod in interface CContextTypeident - method nameparams - method parameterscontext - the context of the class containing
the method call
UnpositionedError - this error will be positioned soon
public CMethodSet lookupMethodOrSet(java.lang.String ident,
CType[] params,
CClassContextType context)
throws UnpositionedError
lookupMethodOrSet in interface CContextTypeident - method nameparams - method parameterscontext - the context of the class containing
the method call
UnpositionedError - this error will be positioned soon
public CFieldAccessor lookupOuterField(java.lang.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 soon
public CFieldAccessor lookupField(java.lang.String ident,
CExpressionContextType context)
throws UnpositionedError
lookupField in interface CContextTypeident - the name of the fieldcontext - the context of the field access
UnpositionedError - this error will be positioned soon
public JExpression lookupOuterLocalVariable(TokenReference ref,
java.lang.String ident)
lookupOuterLocalVariable in interface CContextTyperef - a token reference used to build a new
JOuterLocalVariableExpressionident - the name of the outer variable
public CClassContextType getClassContext()
getClassContext in interface CContextTypepublic CClass getHostClass()
public CClass getOwnerClass()
getHostClass(),
org.multijava.mjc.CExtMethodContext#getHostClass()public 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
duplicated in every anchor.
findNearestHost in interface CContextTypeCMemberHost, i.e., this.self public void resolveMaybeExtMethodRef(java.lang.String ident)
resolveMaybeExtMethodRef in interface CContextTypeident - the name of the generic function to search forpublic void registerVisibleType(CType type)
registerVisibleType in interface CContextType
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||