|
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.JNameExpression
This class represents a name within an expression. This could be a variable reference, a field reference, a type name, a package name. The meaning of the name is determined according to the rules of JLS2 6.5.
| Field Summary | |
private String |
ident
The short name of this, i.e., the name following the dot between prefix and this. |
private JExpression |
prefix
|
private String |
sourceIdent
The identifier as appeared in the source code; note that ident may be changed as the result of typechecking. |
private JExpression |
sourcePrefix
The prefix as appeared in the source code; note that prefix may be changed as the result of typechecking. |
private CUniverse |
universe
The universe associated with the type name. |
| 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 | |
JNameExpression(TokenReference where,
String ident)
Constructs a node in the parsing tree. |
|
JNameExpression(TokenReference where,
String ident,
CUniverse univ)
Constructs a node in the parsing tree. |
|
JNameExpression(TokenReference where,
JExpression prefix,
String ident)
Constructs a node in the parsing tree. |
|
JNameExpression(TokenReference where,
JExpression prefix,
String ident,
CUniverse univ)
Constructs a node in the parsing tree. |
|
| Method Summary | |
void |
accept(MjcVisitor p)
Accepts the specified visitor |
private JExpression |
convertToPackageName(CExpressionContextType context)
Called if the prefix doesn't typecheck, this tries to use the prefix as a package name to be prepended to the identifier hopefully yielding a fully qualified name. |
protected JClassFieldExpression |
createClassField(TokenReference ref,
String ident)
Since class field may be overloaded in sub compiler, this method allow you to specifie the type of class field without needed to touch the huge method above ! |
protected JClassFieldExpression |
createClassField(TokenReference ref,
JExpression prefix,
String ident)
Since class field may be overloaded in sub compiler, this method allow you to specifie the type of class field without needed to touch the huge method above ! |
void |
genCode(CodeSequence code)
Generates a sequence of bytecodes |
String |
getName()
Returns the name of this name expression. |
JExpression |
getPrefix()
|
CType |
getType()
Compute the type of this expression (called after parsing) |
boolean |
isNonNull(CContextType context)
Returns true iff the value represented by this expression is non-null |
String |
qualifiedName()
Returns the longest name available |
String |
sourceIdent()
|
JExpression |
sourcePrefix()
|
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, genBranch, genUniverseDynCheckCode, getApparentType, getBooleanLiteral, getFANonNulls, getFANulls, getLiteral, getNumberLiteral, getOrdinalLiteral, getRealLiteral, getStringLiteral, isAssignableTo, isBooleanLiteral, isConstant, isDeclaredNonNull, isLiteral, isMaybeInitializable, 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 |
private JExpression prefix
private JExpression sourcePrefix
private String sourceIdent
private String ident
private invariant ident != null;
private CUniverse universe
| Constructor Detail |
public JNameExpression(TokenReference where,
String ident)
requires ident != null; ensures this.ident != null;
where - the line of this node in the source codeident - the short name of this name
public JNameExpression(TokenReference where,
String ident,
CUniverse univ)
requires ident != null; ensures this.ident != null;
where - the line of this node in the source codeident - the short name of this nameuniv - the universe modifier WMD
public JNameExpression(TokenReference where,
JExpression prefix,
String ident)
requires ident != null; ensures this.ident != null;
where - the line of this node in the source codeprefix - the primary expression qualifying this nameident - the short name of this name
public JNameExpression(TokenReference where,
JExpression prefix,
String ident,
CUniverse univ)
requires ident != null; ensures this.ident != null;
where - the line of this node in the source codeprefix - the primary expression qualifying this nameident - the short name of this nameuniv - the universe modifier WMD| Method Detail |
public String toString()
toString in class Objectpublic CType getType()
public String getName()
ensures \result != null;
public JExpression getPrefix()
public JExpression sourcePrefix()
public String sourceIdent()
public String qualifiedName()
public boolean isNonNull(CContextType context)
JExpression
isNonNull in class JExpression
public JExpression typecheck(CExpressionContextType context)
throws PositionedError
context - the context in which this expression appears
JExpression.typecheck())
PositionedError - if the check failsJExpression.typecheck(CExpressionContextType)
private JExpression convertToPackageName(CExpressionContextType context)
throws PositionedError
context - the context in which this occurs
PositionedError - if the resulting fully qualified
name is not a valid type name
protected JClassFieldExpression createClassField(TokenReference ref,
JExpression prefix,
String ident)
protected JClassFieldExpression createClassField(TokenReference ref,
String ident)
public void accept(MjcVisitor p)
p - the visitorpublic void genCode(CodeSequence code)
code - the code list
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||