|
||||||||||
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
This class represents a local context during checkBody. It follows the control flow and maintain informations about variable (initialized, used, allocated) and exceptions (thrown, catched.) It also verify that context is still reachable. There is a set of utilities method to access fields, methods and class with the name by clamping the parsing tree.
CContext
,
CCompilationUnitContext
,
CClassContext
,
CMethodContext
,
CBodyContext
,
CBlockContext
Field Summary | |
protected CCompilationUnitContext |
cunit
|
protected CContext |
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 | |
|
CContext()
Construct a non-specific context. |
protected |
CContext(CContext parent)
Construct a non-specifick context. |
Method Summary | |
void |
addFieldInfo(int index,
int info)
|
void |
addSourceClass(CSourceClass clazz)
Adds a class to generate. |
boolean |
check(boolean expr,
MessageDescription mess)
Verify an expression and if false add an error |
boolean |
check(boolean expr,
MessageDescription mess,
java.lang.Object param1)
Verify an expression and if false add an error |
boolean |
check(boolean expr,
MessageDescription mess,
java.lang.Object param1,
java.lang.Object param2)
Verify an expression and if false add an error |
void |
fail(MessageDescription mess,
java.lang.Object param1,
java.lang.Object param2)
Add an error into the list and eat it. |
CBlockContext |
getBlockContext()
Returns the nearest block context. |
CClassContext |
getClassContext()
Returns the nearest parent of type CClassContext. |
CCompilationUnitContext |
getCompilationUnit()
|
Compiler |
getCompiler()
Gets the compiler |
int |
getFieldInfo(int index)
|
CMethodContext |
getMethodContext()
Returns the nearest parent of type CMethodContext. |
CContext |
getParentContext()
getParentContext |
CClassType |
lookupClass(java.lang.String name)
Search for a class with the provided name. |
CField |
lookupField(java.lang.String ident)
lookupLocalVariable |
JLocalVariable |
lookupLocalVariable(java.lang.String ident)
lookupLocalVariable |
CMethod |
lookupMethod(CClass caller,
java.lang.String ident,
CType[] params)
Search for a matching method with the provided type parameters. |
void |
reportTrouble(PositionedError trouble)
Add an error into the list and eat it. |
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 CContext parent
protected CCompilationUnitContext cunit
Constructor Detail |
public CContext()
protected CContext(CContext parent)
parent
- The parent context. May not be null except if called by the top level.Method Detail |
public CClassType lookupClass(java.lang.String name) throws UnpositionedError
name
- Method name.UnpositionedError
- This error will be positioned soon.public CMethod lookupMethod(CClass caller, java.lang.String ident, CType[] params) throws UnpositionedError
caller
- Caller context or null
for unspecified context.ident
- Method name.params
- Method parametersUnpositionedError
- This error will be positioned soon.public CField lookupField(java.lang.String ident) throws UnpositionedError
UnpositionedError
- this error will be positioned soonpublic JLocalVariable lookupLocalVariable(java.lang.String ident)
ident
- the name of the local variablepublic int getFieldInfo(int index)
field
- the definition of a fieldpublic void addFieldInfo(int index, int info)
field
- the definition of a fieldpublic CContext getParentContext()
public CCompilationUnitContext getCompilationUnit()
public CClassContext getClassContext()
public CMethodContext getMethodContext()
public CBlockContext getBlockContext()
public void addSourceClass(CSourceClass clazz)
public void reportTrouble(PositionedError trouble)
error
- the errorpublic void fail(MessageDescription mess, java.lang.Object param1, java.lang.Object param2) throws UnpositionedError
mess
- the error messageparam1
- the first message parameterparam2
- the second message parameterUnpositionedError
- this error will be positioned soonpublic boolean check(boolean expr, MessageDescription mess) throws UnpositionedError
expr
- condition to verifyphyl
- where the error occurmess
- the message to be displayedUnpositionedError
- this error will be positioned soonpublic boolean check(boolean expr, MessageDescription mess, java.lang.Object param1) throws UnpositionedError
expr
- condition to verifymess
- the message to be displayedparam1
- the first parameterUnpositionedError
- this error will be positioned soonpublic boolean check(boolean expr, MessageDescription mess, java.lang.Object param1, java.lang.Object param2) throws UnpositionedError
expr
- condition to verifymess
- the message to be displayedparam1
- the first parameterparam2
- the second parameterUnpositionedError
- this error will be positioned soonpublic Compiler getCompiler()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |