|
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.util.compiler.Phylum
org.multijava.mjc.JPhylum
org.multijava.mjc.JExpression
org.multijava.mjc.JClassFieldExpression
This class represents the AST node for a field access, e.g.
getExpression().t or t.
| Field Summary | |
private CFieldAccessor |
field
|
private CUniverse |
field_universe
|
private CType |
fieldtype
|
private String |
ident
|
private JExpression |
prefix
|
private CUniverse |
prefix_universe
|
private boolean |
prefixWasBlank
If true, indicates that this was a simple field reference without an explicit prefix. |
private CUniverse |
result_universe
|
private JNameExpression |
sourceName
the name of this field reference as originally appeared in the source file. |
| 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 | |
JClassFieldExpression(TokenReference where,
String ident)
Construct a node in the parsing tree. |
|
JClassFieldExpression(TokenReference where,
String ident,
JNameExpression sourceName)
Construct a node in the parsing tree. |
|
JClassFieldExpression(TokenReference where,
JExpression prefix,
String ident)
Construct a node in the parsing tree. |
|
JClassFieldExpression(TokenReference where,
JExpression prefix,
String ident,
JNameExpression sourceName)
Construct a node in the parsing tree. |
|
| Method Summary | |
void |
accept(MjcVisitor p)
Accepts the specified visitor |
private void |
checkAccess(CMemberHost localHost,
CExpressionContextType context)
Verifies that the field is accessible in this context. |
boolean |
equals(Object o)
|
private void |
findPrefixAndField(CMemberHost localHost,
CExpressionContextType context)
Finds the type of the prefix as part of typechecking. |
void |
genCode(CodeSequence code)
Generates a sequence of bytecodes |
void |
genEndStoreCode(CodeSequence code,
boolean discardValue)
Generates a sequence of bytecodes |
void |
genStartStoreCode(CodeSequence code)
Generates a sequence of bytecodes |
CFieldAccessor |
getField()
Returns the CField represented by this expression. |
JLiteral |
getLiteral()
Returns the literal value of this field. |
CType |
getType()
Compute the type of this expression (called after parsing) |
private void |
handlePossibleRawTypeAccess(CExpressionContextType context)
If a non-static field is accessed as a member of a raw type, the following actions are performed (see JLS3 4.8): Replace the type of the field access expression by its erasure. |
int |
hashCode()
Throws a runtime exception because hashCode isn't properly implemented yet. |
String |
ident()
|
void |
initialize(CContextType context)
Records that this field is initialized in the given context. |
boolean |
isConstant()
|
boolean |
isDeclaredNonNull()
Returns true iff the variable, field or method represente by this expression was declared non_null. |
boolean |
isDefinitelyAssigned(CContextType context)
Returns true if this field is already initialized |
private boolean |
isFinalNonNull()
|
boolean |
isLValue(CExpressionContextType context)
Returns true if this field accepts assignment. |
boolean |
isMaybeInitializable()
Indicates whether this expression can appear on the left-hand side of an assignment or in an increment or decrement operation. |
boolean |
isNonNull(CContextType context)
Returns true iff the value represented by this expression is non-null |
JExpression |
prefix()
|
boolean |
prefixWasBlank()
Returns true if the prefix was blank. |
void |
setField(CFieldAccessor field)
|
void |
setType(CType type)
|
JNameExpression |
sourceName()
Returns the name of this field reference as originally appeared in the source file. |
String |
toString()
|
JExpression |
typecheck(CExpressionContextType context)
Typechecks the expression and mutates the context to record information gathered during typechecking. |
private void |
typecheckUniverse(CExpressionContextType context)
Performs all the checks whether the class field expression is valid according to the universe type system. |
| Methods inherited from class org.multijava.mjc.JExpression |
buildUniverseDynChecks, clone, convertType, dumpArray, fail, genBranch, genUniverseDynCheckCode, getApparentType, getBooleanLiteral, getFANonNulls, getFANulls, getNumberLiteral, getOrdinalLiteral, getRealLiteral, getStringLiteral, isAssignableTo, isBooleanLiteral, isLiteral, 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 |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
private JExpression prefix
private String ident
private CFieldAccessor field
private CType fieldtype
private CUniverse prefix_universe
private CUniverse field_universe
private CUniverse result_universe
private boolean prefixWasBlank
private JNameExpression sourceName
| Constructor Detail |
public JClassFieldExpression(TokenReference where,
JExpression prefix,
String ident,
JNameExpression sourceName)
where - the line of this node in the source codeprefix - the expression preceding the field nameident - the field namesourceName - the name of this reference as originally
appeared in source file. It may be null if generated.
requires prefix != null; ensures !prefixWasBlank;
public JClassFieldExpression(TokenReference where,
String ident,
JNameExpression sourceName)
where - the line of this node in the source codeident - the field namesourceName - the name of this reference as originally
appeared in source file. It may be null if generated.
ensures prefixWasBlank;
public JClassFieldExpression(TokenReference where,
JExpression prefix,
String ident)
where - the line of this node in the source codeprefix - the expression preceding the field nameident - the field name
requires prefix != null; ensures !prefixWasBlank;
public JClassFieldExpression(TokenReference where,
String ident)
where - the line of this node in the source codeident - the field name
ensures prefixWasBlank;
| Method Detail |
public JNameExpression sourceName()
public boolean prefixWasBlank()
ensures \result == prefixWasBlank;
public JExpression prefix()
public String ident()
public CType getType()
public void setType(CType type)
public boolean isNonNull(CContextType context)
isNonNull in class JExpressionpublic boolean isDeclaredNonNull()
JExpression
isDeclaredNonNull in class JExpressionprivate boolean isFinalNonNull()
public boolean isConstant()
isConstant in class JExpressionpublic boolean isMaybeInitializable()
also ensures true;
isMaybeInitializable in class JExpressionpublic boolean isLValue(CExpressionContextType context)
isLValue in interface CInitializablepublic boolean isDefinitelyAssigned(CContextType context)
isDefinitelyAssigned in interface CInitializable
public void initialize(CContextType context)
throws UnpositionedError
initialize in interface CInitializableUnpositionedError - if this is a final field and has
already been assigned to public CFieldAccessor getField()
public void setField(CFieldAccessor field)
public JLiteral getLiteral()
getLiteral in class JExpressionpublic String toString()
toString in class Object
public JExpression typecheck(CExpressionContextType context)
throws PositionedError
context - the context in which this expression appears
JExpression.typecheck())
PositionedError - if the check fails
private void findPrefixAndField(CMemberHost localHost,
CExpressionContextType context)
throws PositionedError
field to the signature of the field referenced.
PositionedError
private void handlePossibleRawTypeAccess(CExpressionContextType context)
throws PositionedError
context - The typechecking context.
PositionedError - if an error occurs during typechecking.
private void checkAccess(CMemberHost localHost,
CExpressionContextType context)
throws PositionedError
PositionedError - if a check failspublic boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
private void typecheckUniverse(CExpressionContextType context)
throws PositionedError
PositionedErrorpublic void accept(MjcVisitor p)
p - the visitorpublic void genCode(CodeSequence code)
code - the code listpublic void genStartStoreCode(CodeSequence code)
genStartStoreCode in interface CInitializablecode - the code list
public void genEndStoreCode(CodeSequence code,
boolean discardValue)
genEndStoreCode in interface CInitializablecode - the code list
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||