|
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.JBinaryExpression
org.multijava.mjc.JBinaryArithmeticExpression
org.multijava.mjc.JShiftExpression
This class represents the shift (left, right, boolean-right) binary expressions.
| Field Summary | |
protected int |
oper
|
| Fields inherited from class org.multijava.mjc.JBinaryExpression |
left, right, 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 | |
JShiftExpression(TokenReference where,
int oper,
JExpression left,
JExpression right)
Construct a node in the parsing tree This method is directly called by the parser |
|
| Method Summary | |
void |
accept(MjcVisitor p)
Accepts the specified visitor |
int |
compute(int left,
int right)
Computes the result of the operation at compile-time (JLS 15.27). |
long |
compute(long left,
int right)
Computes the result of the operation at compile-time (JLS 15.27). |
static CType |
computeType(CType leftType,
CType rightType)
compute the type of this expression according to operands |
JExpression |
constantFolding()
Converts two constant expressions into a single literal that is the result of applying this operation to the expressions. |
void |
genCode(CodeSequence code)
Generates a sequence of bytecodes |
static int |
getOpcode(int oper,
CType type)
|
int |
oper()
|
String |
toString()
|
JExpression |
typecheck(CExpressionContextType context)
Typechecks the expression and mutates the context to record information gathered during typechecking. |
JExpression |
typecheckBinaryArith(CExpressionContextType context)
Typechecks a binary arithmetic expression and handles simple optimizations like constant folding. |
| Methods inherited from class org.multijava.mjc.JBinaryExpression |
genBooleanResultCode, genBranch, genBranch, getType, left, promote, right, setLeft, setRight, setType |
| 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
| Constructor Detail |
public JShiftExpression(TokenReference where,
int oper,
JExpression left,
JExpression right)
where - the line of this node in the source codeoper - the operatorleft - the left operandright - the right operand| Method Detail |
public String toString()
toString in class Object
public JExpression typecheck(CExpressionContextType context)
throws PositionedError
typecheck in class JBinaryArithmeticExpressioncontext - the context in which this expression appears
JExpression.typecheck())
PositionedError - if the check fails
public JExpression typecheckBinaryArith(CExpressionContextType context)
throws PositionedError
context - the actual context of analysis
JExpression.typecheck())
PositionedError - if checks fail
public static CType computeType(CType leftType,
CType rightType)
throws UnpositionedError
leftType - the type of left operandrightType - the type of right operand
UnpositionedError - this error will be positioned soonpublic JExpression constantFolding()
public int compute(int left,
int right)
left - the first operandright - the seconds operand
public long compute(long left,
int right)
left - the first operandright - the seconds operand
public void accept(MjcVisitor p)
p - the visitor
public static int getOpcode(int oper,
CType type)
type - the type of result
public void genCode(CodeSequence code)
code - the code listpublic int oper()
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||