|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.util.compiler.Phylum
org.multijava.mjc.JPhylum
org.multijava.mjc.JExpression
org.multijava.mjc.JUnaryExpression
This class represents unary expressions (unary plus, unary minus, bitwise complement, and logical not).
| Field Summary | |
protected JExpression |
expr
|
private boolean |
isInSafeMathMode
|
protected int |
oper
|
protected CType |
type
|
| Fields inherited from class org.multijava.mjc.JExpression |
EMPTY |
| Fields inherited from class org.multijava.util.compiler.Phylum |
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
JUnaryExpression(TokenReference where,
int oper,
JExpression expr)
Construct a node in the parsing tree. |
|
| Method Summary | |
void |
accept(MjcVisitor p)
Accepts the specified visitor |
protected JExpression |
binaryNotConstantFolding()
Constant Folding (~) |
JExpression |
expr()
|
void |
genBranch(boolean cond,
CodeSequence code,
CodeLabel label)
Generates a sequence of bytecodes to branch on a label This method helps to handle heavy optimizables conditions |
void |
genCode(CodeSequence code)
Generates a sequence of bytecodes |
CType |
getType()
Compute the type of this expression (called after parsing) |
protected JExpression |
logicalNotConstantFolding()
Constant Folding (!) |
protected JExpression |
noFolding(JExpression expr,
CExpressionContextType context)
No Constant Folding (to be overridden in JML) |
int |
oper()
|
protected JExpression |
plusMinusConstantFolding(CExpressionContextType context)
Constant Folding (+, -) |
void |
setExpr(JExpression e)
|
void |
setType(CType t)
|
String |
toString()
|
JExpression |
typecheck(CExpressionContextType context)
Typechecks the expression and mutates the context to record information gathered during typechecking. |
| Methods inherited from class org.multijava.mjc.JExpression |
buildUniverseDynChecks, clone, convertType, dumpArray, fail, genUniverseDynCheckCode, getApparentType, getBooleanLiteral, getFANonNulls, getFANulls, getLiteral, getNumberLiteral, getOrdinalLiteral, getRealLiteral, getStringLiteral, isAssignableTo, isBooleanLiteral, isConstant, isDeclaredNonNull, isLiteral, isMaybeInitializable, isNonNull, isOrdinalLiteral, isRealLiteral, isStatementExpression, isStringLiteral, typecheck, unParenthesize |
| Methods inherited from class org.multijava.mjc.JPhylum |
check, check, check, check, fail, fail, warn, warn, warn, warn |
| Methods inherited from class org.multijava.util.compiler.Phylum |
getTokenReference, setTokenReference |
| 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 |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected int oper
protected JExpression expr
protected CType type
private boolean isInSafeMathMode
| Constructor Detail |
public JUnaryExpression(TokenReference where,
int oper,
JExpression expr)
where - the line of this node in the source codeoper - the operatorexpr - the operand| Method Detail |
public int oper()
public JExpression expr()
public void setExpr(JExpression e)
public String toString()
toString in class Objectpublic CType getType()
public void setType(CType t)
public JExpression typecheck(CExpressionContextType context)
throws PositionedError
context - the context in which this expression appears
JExpression.typecheck())
PositionedError - if the check fails
protected JExpression noFolding(JExpression expr,
CExpressionContextType context)
throws PositionedError
PositionedError
protected JExpression plusMinusConstantFolding(CExpressionContextType context)
throws PositionedError
PositionedErrorprotected JExpression binaryNotConstantFolding()
protected JExpression logicalNotConstantFolding()
public void accept(MjcVisitor p)
p - the visitorpublic void genCode(CodeSequence code)
code - the code list
public void genBranch(boolean cond,
CodeSequence code,
CodeLabel label)
genBranch in class JExpressioncode - the code list
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||