All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----epp.Macro
|
+----epp.TypeChecker
TypeChecker class is the super class of all
TypeChecker object classes.
Within the type checking pass, each node of an abstract syntax tree are
type checked with the call method of the corresponding
TypeChecker object, and are converted to abstract syntax trees
with type information.
Type information of a Trees with type information can be
retrieved using the method type.
The type checking pass can execute not only type checking but also "macro
expansion using type information."
Plug-in programmers may introduce a non-Java standard node and define
a corresponding TypeChecker object.
In this case, the TypeChecker object type checks the subtree
as required, expand macros using these type information, and returns the
result.
The TypeChecker object the plug-in programmer defined must
be registered to the TypeChecker.macroTable using the
definedTypeChecker method of epp.
The TypeChecker object can be extended by difference
using the decorator pattern.
In order to do so, you use the extendTypeChecker method of Epp.
You can call the original TypeChecker.
If not extended with extendTypeChecker, the value of
variable orig will be null.
The recursive type checking of a Treeis done by the
typeCheckTree method. The behaviour of the
typeCheckTree method is actually defined as follows.
Symbol lastTag = null;
while(true) {
if (tree.isTyped()) break;
Symbol tag = tree.tag();
if (tag == lastTag) break;
lastTag = tag;
TypeChecker func = (TypeChecker)typeCheckerTable.get(tag);
if (func != null) {
tree = func.call(tree);
} else {
throw error("TypeCheker for "+ tag+ " is not defined.");
}
}
return tree;
That is, it calls method call of the TypeChecker
object corresponding to the tree and tag, and if the returned tag and
the tag prior to calling match, exits the loop and returns the return value.
Otherwise, continues converting with TypeChecker until the tag
does not change.
checkVariableDeclaratorId of the EPP preprocessor.
Tree.
TypeNameChecker.typeNameCheckTree.
public TypeChecker()
public abstract Tree call(Tree tree)
TypeChecker of the non-standard node
introduced by a plug-in must normally behave as shown in
the secode arlternative.
public static Tree typeCheckTree(Tree tree)
public static Tree typeCheck1(Tree tree)
public static Tree[] typeCheckArgs(Tree tree)
public static Tree typeNameCheckTree(Tree tree)
TypeNameChecker.typeNameCheckTree.
public static void checkArgsLength(Tree tree,
int argc)
error method is called.
public static Tree checkVariableDeclaratorId(Type type,
Tree tree,
Tree declaredVars[])
checkVariableDeclaratorId of the EPP preprocessor.
public static Tree resolveAmbiguousName(Tree tree)
Tree.
For information regarding the rules of resolving ambiguity, please
refer to JLS1.0 Section 6.5.2.
This method receives a Tree in the form of
(name ...) and converts into one of the Tree of type
id, name, fieldStatic, or fieldExp.
If the Tree cannot be interpreted, this method returns
null.
public static Tree unaryNumericPromotion(Tree tree)
All Packages Class Hierarchy This Package Previous Next Index