|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--at.dms.util.Utils | +--at.dms.kjc.CContext | +--at.dms.kjc.CClassContext
This class represents a class context during check.
CCompilationUnitContext
,
CClassContext
,
CMethodContext
,
CContext
Field Summary | |
protected CSourceClass |
self
The class that provides this context. |
Fields inherited from class at.dms.kjc.CContext |
cunit, parent |
Fields inherited from class at.dms.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
Fields inherited from interface at.dms.kjc.Constants |
CMP_VERSION, JAV_CLASS, JAV_CLONE, JAV_CLONEABLE, JAV_CONSTRUCTOR, JAV_ERROR, JAV_EXCEPTION, JAV_INIT, JAV_LENGTH, JAV_NAME_SEPARATOR, JAV_OBJECT, JAV_OUTER_THIS, JAV_RUNTIME, JAV_RUNTIME_EXCEPTION, JAV_STATIC_INIT, JAV_STRING, JAV_STRINGBUFFER, JAV_THIS, JAV_THROWABLE, OPE_BAND, OPE_BNOT, OPE_BOR, OPE_BSR, OPE_BXOR, OPE_EQ, OPE_GE, OPE_GT, OPE_LE, OPE_LNOT, OPE_LT, OPE_MINUS, OPE_NE, OPE_PERCENT, OPE_PLUS, OPE_POSTDEC, OPE_POSTINC, OPE_PREDEC, OPE_PREINC, OPE_SIMPLE, OPE_SL, OPE_SLASH, OPE_SR, OPE_STAR, TID_ARRAY, TID_BOOLEAN, TID_BYTE, TID_CHAR, TID_CLASS, TID_DOUBLE, TID_FLOAT, TID_INT, TID_LONG, TID_SHORT, TID_VOID |
Constructor Summary | |
(package private) |
CClassContext(CContext parent,
CSourceClass clazz,
JTypeDeclaration decl)
Constructs a class context. |
Method Summary | |
void |
addFieldInfo(int index,
int info)
Sets field info about a specific field. |
void |
addInitializer()
Add an initializer to this context. |
void |
close(JTypeDeclaration decl,
CVariableInfo staticInfo,
CVariableInfo instanceInfo,
CVariableInfo[] constructorsInfo)
Verify all final fields are initialized. |
CConstructorContext |
createConstructorContext(CMethod self)
Makes new constructor-method context. |
CMethodContext |
createMethodContext(CMethod self)
Makes new method context. |
CSourceClass |
getCClass()
Returns the nearest class parent in this context, which is of type CSourceClass. |
CClassContext |
getClassContext()
getClassContext |
int |
getFieldInfo(int index)
Returns information about a specific field. |
CMethodContext |
getMethod()
getMethod |
int |
getNextAnonymousIndex()
|
int |
getNextSyntheticIndex()
|
JTypeDeclaration |
getTypeDeclaration()
getTypeDeclaration |
CVariableInfo |
getVariableInfo()
Returns old field info and resets field info to a clean slate. |
int |
getVariableInfo(int index)
|
boolean |
hasInitializer()
Returns true if this class need initializers |
CClassType |
lookupClass(java.lang.String name)
Search for a class with the provided name. |
CField |
lookupField(java.lang.String ident)
lookupField |
JLocalVariable |
lookupLocalVariable(java.lang.String ident)
lookupLocalVariable |
CMethod |
lookupMethod(CClass caller,
java.lang.String ident,
CType[] params)
Searches for a matching method with the provided type parameters. |
CField |
lookupOuterField(java.lang.String ident)
lookupField |
JExpression |
lookupOuterLocalVariable(TokenReference ref,
java.lang.String ident)
lookupOuterLocalVariable |
void |
markAllFieldsAsInitialized()
Marks all fields as 'initialized' |
void |
setVariableInfo(CVariableInfo info)
Sets assignment information for all fields at once. |
Methods inherited from class at.dms.kjc.CContext |
addSourceClass, check, check, check, fail, getBlockContext, getCompilationUnit, getCompiler, getMethodContext, getParentContext, reportTrouble |
Methods inherited from class at.dms.util.Utils |
assert, assert, fail, fail, hasFlag, hasMoreThanOneFlag, hasOtherFlags, splitQualifiedName, splitQualifiedName, vectorToArray, vectorToIntArray |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected CSourceClass self
Constructor Detail |
CClassContext(CContext parent, CSourceClass clazz, JTypeDeclaration decl)
parent
- The parent context or null at top level.clazz
- The corresponding clazz.Method Detail |
public void close(JTypeDeclaration decl, CVariableInfo staticInfo, CVariableInfo instanceInfo, CVariableInfo[] constructorsInfo) throws UnpositionedError
UnpositionedError
- This error will be positioned soon.public CMethodContext createMethodContext(CMethod self)
public CConstructorContext createConstructorContext(CMethod self)
public void addInitializer()
public boolean hasInitializer()
public int getNextSyntheticIndex()
CSourceClass.getNextSyntheticIndex()
public int getNextAnonymousIndex()
CSourceClass.getNextAnonymousIndex()
public int getVariableInfo(int index)
var
- the definition of a variablepublic int getFieldInfo(int index)
getFieldInfo
in class CContext
index
- The field position in the field array.public void addFieldInfo(int index, int info)
addFieldInfo
in class CContext
index
- The field position in the field array.info
- The information to add.
We make it a local copy of this information and at the end of this
context we will transfert it to the parent context according to
controlFlow.public CVariableInfo getVariableInfo()
public void markAllFieldsAsInitialized()
public void setVariableInfo(CVariableInfo info)
public CClassType lookupClass(java.lang.String name) throws UnpositionedError
lookupClass
in class CContext
name
- Method nameUnpositionedError
- This error will be positioned soon.public CMethod lookupMethod(CClass caller, java.lang.String ident, CType[] params) throws UnpositionedError
lookupMethod
in class CContext
caller
- The class containing the statement that calls the method, used for
access checks. May be null
to suppress access checks.ident
- Method name.params
- Method parameters.UnpositionedError
- This error will be positioned soon.public CField lookupOuterField(java.lang.String ident) throws UnpositionedError
ident
- the name of the fieldUnpositionedError
- this error will be positioned soonpublic CField lookupField(java.lang.String ident) throws UnpositionedError
lookupField
in class CContext
ident
- the name of the fieldUnpositionedError
- this error will be positioned soonpublic JExpression lookupOuterLocalVariable(TokenReference ref, java.lang.String ident)
ident
- the name of the outer variablepublic JLocalVariable lookupLocalVariable(java.lang.String ident)
lookupLocalVariable
in class CContext
ident
- the name of the local variablepublic CClassContext getClassContext()
getClassContext
in class CContext
public CSourceClass getCClass()
public CMethodContext getMethod()
public JTypeDeclaration getTypeDeclaration()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |