|
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.CFlowControlContext
org.multijava.mjc.CSwitchBodyContext
This class represents the context for the body of a switch statement during checking passes (checkInterface, checkInitializers, typecheck). It includes methods for collecting labeled cases and the default case and for determining where a break should take the control flow.
CContextType| Field Summary | |
private boolean |
defaultExist
|
private Hashtable |
labels
|
private JSwitchStatement |
stmt
|
private CType |
switchType
|
| Fields inherited from class org.multijava.mjc.CFlowControlContext |
cachedParent, fieldInfo, isReachable, methodContext, variableInfo |
| Fields inherited from class org.multijava.mjc.CContext |
contextNullity, cunit, parent |
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
(package private) |
CSwitchBodyContext(CFlowControlContextType parent,
JSwitchStatement stmt,
CType switchType)
Construct a context for a switch statement. |
| Method Summary | |
void |
addDefault()
Adds a default label to this switch. |
void |
addLabel(JOrdinalLiteral lit)
Adds a label to this switch and checks that it is a new one. |
void |
adoptSwitchGroupContext(CSwitchGroupContext previousContext)
Records that previousContext is no longer being
used and that all block statements inside the switch body have
been checked. |
CSwitchGroupContext |
createSwitchGroupContext(CSwitchGroupContext previousContext,
TokenReference where)
Creates a context for checking the statements in a labelled block statement group within this switch. |
boolean |
defaultExists()
|
JStatement |
getNearestBreakableStatement()
remove a label from the list of labels |
| 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private boolean defaultExist
private Hashtable labels
private JSwitchStatement stmt
private CType switchType
| Constructor Detail |
CSwitchBodyContext(CFlowControlContextType parent,
JSwitchStatement stmt,
CType switchType)
CFlowControlContextType.createSwitchBodyContext.
requires (* \caller instanceof CContextType *);
parent - the parent context, it must be different
than nullswitchType - the size of switch (byte, short, char...)CFlowControlContextType.createSwitchBodyContext(JSwitchStatement,CType)| Method Detail |
public void addDefault()
throws UnpositionedError
UnpositionedError - if a default label already exists
public void addLabel(JOrdinalLiteral lit)
throws UnpositionedError
lit - the literal value of this label
UnpositionedError - if the label is badpublic boolean defaultExists()
public JStatement getNearestBreakableStatement()
getNearestBreakableStatement in interface CFlowControlContextTypegetNearestBreakableStatement in class CFlowControlContext
public CSwitchGroupContext createSwitchGroupContext(CSwitchGroupContext previousContext,
TokenReference where)
previousContext argument of this method or
adoptSwitchGroupContext.
requires previousContext == null <==> (* the returned context is for the first group *);
adoptSwitchGroupContext(CSwitchGroupContext)public void adoptSwitchGroupContext(CSwitchGroupContext previousContext)
previousContext is no longer being
used and that all block statements inside the switch body have
been checked. Prepares this context for adoption by its parent
context.
requires previousContext != null && (* previousContext is for last group in switch *);
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||