|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.dms.util.Utils
at.dms.compiler.Phylum
at.dms.kjc.JPhylum
at.dms.kjc.JExpression
public abstract class JExpression
Root class for all expressions
Field Summary | |
---|---|
static JExpression[] |
EMPTY
|
Fields inherited from class at.dms.util.Utils |
---|
EMPTY_LIST, getForLoopCallers |
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_BIT, TID_BOOLEAN, TID_BYTE, TID_CHAR, TID_CLASS, TID_DOUBLE, TID_FLOAT, TID_INT, TID_LONG, TID_SHORT, TID_VECTOR, TID_VOID, VECTOR_EMPTY |
Constructor Summary | |
---|---|
protected |
JExpression()
|
|
JExpression(TokenReference where)
Construct a node in the parsing tree |
Method Summary | ||
---|---|---|
abstract Object |
accept(AttributeVisitor p)
Accepts the specified attribute visitor |
|
abstract
|
accept(ExpressionVisitor<S,T> p,
T d)
Accepts the specified expression visitor |
|
abstract void |
accept(KjcVisitor p)
Accepts the specified visitor |
|
abstract JExpression |
analyse(CExpressionContext context)
Analyses the expression (semantically). |
|
boolean |
booleanValue()
Returns the constant value of the expression. |
|
byte |
byteValue()
Returns the constant value of the expression. |
|
char |
charValue()
Returns the constant value of the expression. |
|
JExpression |
convertType(CType dest)
Analyse without a null context. |
|
JExpression |
convertType(CType dest,
CExpressionContext context)
convertType changes the type of this expression to an other |
|
Object |
deepClone()
Returns a deep clone of this object. |
|
protected void |
deepCloneInto(JExpression other)
Clones all fields of this into |
|
double |
doubleValue()
Returns the constant value of the expression. |
|
protected void |
fail(CContext context,
MessageDescription key,
Object[] params)
Adds a compiler error. |
|
float |
floatValue()
Returns the constant value of the expression. |
|
void |
genBranch(boolean cond,
CodeSequence code,
at.dms.kjc.CodeLabel label)
Generates a sequence of bytescodes to branch on a label This method helps to handle heavy optimizables conditions |
|
abstract void |
genCode(CodeSequence code,
boolean discardValue)
Generates JVM bytecode to evaluate this expression. |
|
void |
genEndStoreCode(CodeSequence code,
boolean discardValue)
Generates JVM bytecode to store a value into the storage location denoted by this expression. |
|
void |
genStartStoreCode(CodeSequence code)
Generates JVM bytecode to store a value into the storage location denoted by this expression. |
|
String |
getIdent()
Used in field access expressions, local variable expression ... |
|
JLiteral |
getLiteral()
Returns the literal value of this field |
|
abstract CType |
getType()
Returns the type of this expression (call after parsing only) |
|
int |
intValue()
Returns the constant value of the expression. |
|
boolean |
isAssignableTo(CType dest)
Can this expression be converted to the specified type by assignment conversion (JLS 5.2) ? |
|
boolean |
isConstant()
Tests whether this expression denotes a compile-time constant (JLS 15.28). |
|
boolean |
isDynamic()
Returns true only for SIRRangeExpressions, which represent a dynamic range of values. |
|
boolean |
isFinal()
Tests whether this expression is final, like a variable, which is final. |
|
boolean |
isInitialized(CExpressionContext context)
|
|
boolean |
isLValue(CExpressionContext context)
Tests whether this expression can be at the left-hand side of an assignment, i.e. |
|
boolean |
isStatementExpression()
Returns true iff this expression can be used as a statement (JLS 14.8) |
|
long |
longValue()
Returns the constant value of the expression. |
|
void |
setInitialized(CExpressionContext context)
Declares this variable to be initialized. |
|
abstract void |
setType(CType type)
Set the type of this expression. |
|
short |
shortValue()
Returns the constant value of the expression. |
|
String |
stringValue()
Returns the constant value of the expression. |
Methods inherited from class at.dms.kjc.JPhylum |
---|
assertMutable, check, check, check, check, deepCloneInto, setLineNumber |
Methods inherited from class at.dms.compiler.Phylum |
---|
deepCloneInto, getTokenReference, setTokenReference |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final JExpression[] EMPTY
Constructor Detail |
---|
protected JExpression()
public JExpression(TokenReference where)
where
- the line of this node in the source codeMethod Detail |
---|
public abstract CType getType()
public abstract void setType(CType type)
type
- the CType to set.public boolean isConstant()
public boolean isStatementExpression()
public JLiteral getLiteral()
public boolean booleanValue()
public byte byteValue()
public char charValue()
public double doubleValue()
public float floatValue()
public int intValue()
public long longValue()
public short shortValue()
public String stringValue()
public boolean isDynamic()
public boolean isLValue(CExpressionContext context)
public boolean isFinal()
public String getIdent()
public void setInitialized(CExpressionContext context) throws UnpositionedError
UnpositionedError
- an error if this object can't actually
be assignated this may happen with final variables.public boolean isInitialized(CExpressionContext context)
public abstract JExpression analyse(CExpressionContext context) throws PositionedError
context
- the analysis context
PositionedError
- the analysis detected an errorprotected void fail(CContext context, MessageDescription key, Object[] params) throws PositionedError
fail
in class JPhylum
context
- the context in which the error occurredkey
- the message ident to be displayedparams
- the array of parameters
PositionedError
public JExpression convertType(CType dest)
public JExpression convertType(CType dest, CExpressionContext context) throws PositionedError
dest
- the destination type
PositionedError
public boolean isAssignableTo(CType dest)
dest
- the destination type
public abstract void accept(KjcVisitor p)
accept
in class JPhylum
p
- the visitorpublic abstract Object accept(AttributeVisitor p)
accept
in class JPhylum
p
- the visitor
public abstract <S,T> S accept(ExpressionVisitor<S,T> p, T d)
S
- output typeT
- auxilliary input typep
- the visitord
- data passed through to sub-visits
public abstract void genCode(CodeSequence code, boolean discardValue)
code
- the code listdiscardValue
- discard the result of the evaluation ?public void genBranch(boolean cond, CodeSequence code, at.dms.kjc.CodeLabel label)
code
- the code listpublic void genStartStoreCode(CodeSequence code)
code
- the code listpublic void genEndStoreCode(CodeSequence code, boolean discardValue)
code
- the code listdiscardValue
- discard the result of the evaluation ?public Object deepClone()
deepClone
in interface DeepCloneable
deepClone
in class JPhylum
protected void deepCloneInto(JExpression other)
other
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |