|
ESC/Java2 © 2003,2004,2005,2006 David Cok and Joseph Kiniry © 2005,2006 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavafe.tc.FlowInsensitiveChecks
Does disambiguation and flow insensitive checks on a type declaration.
| Field Summary | |
protected TypeSigVec |
allowedExceptions
|
private static ASTDecoration |
branchDecoration
Decorates BranchStmt nodes to point to labelled Stmt
objects. |
static boolean |
dontAddImplicitConstructorInvocations
Controls whether or not implicit super-calls in constructors are made explicit. |
protected StmtVec |
enclosingLabels
|
(package private) boolean |
impl_peerInStaticCautionThrown
|
(package private) boolean |
inCtor
|
(package private) boolean |
inPure
|
static FlowInsensitiveChecks |
inst
|
(package private) boolean |
inStatic
|
protected boolean |
leftToRight
|
(package private) boolean |
readonlyStdForPureCtor
|
protected Type |
returnType
|
protected EnvForTypeSig |
rootIEnv
|
protected EnvForTypeSig |
rootSEnv
|
protected TypeSig |
sig
|
private static ASTDecoration |
typeDecoration
Decorates VarInit nodes to point to Type objects. |
(package private) int |
universeElementReturnType
|
(package private) int |
universeReturnType
|
protected boolean |
useUniverses
|
| Constructor Summary | |
protected |
FlowInsensitiveChecks()
|
| Method Summary | |
protected boolean |
assignmentConvertable(Expr e,
Type t)
Checks if Exp e can be assigned to Type t. |
protected Expr |
checkAmbiguousMethodInvocationExpr(Env env,
AmbiguousMethodInvocation ami)
Disambiguates an ambiguous method invocation and then typechecks it. |
protected Expr |
checkAmbiguousVariableAccessExpr(Env env,
AmbiguousVariableAccess av)
Disambiguates an ambiguous variable access and then typechecks (e.g., x). |
protected ArrayRefExpr |
checkArrayRefExpr(Env env,
ArrayRefExpr r)
Typechecks an array reference expression (e.g., a[3]). |
protected Expr |
checkAssignmentExpr(Env env,
BinaryExpr be)
Typecheck assignment-like expressions (e.g., a += 2). |
protected Expr |
checkBinaryExpr(Env env,
BinaryExpr be)
Typecheck simple binary expressions (e.g., x + y). |
protected Type |
checkBinaryExpr(int op,
Expr left,
Expr right,
int loc)
|
protected Expr |
checkBitnotExpr(Env env,
UnaryExpr ue)
Typecheck bitwise negation (e.g., ~x). |
protected Expr |
checkBooleanLitExpr(Expr x)
Typechecks booleans. |
protected CastExpr |
checkCastExpr(Env env,
CastExpr ce)
Typecheck a (dynamic) cast. |
protected Expr |
checkCharLitExpr(Expr x)
Typechecks characters. |
protected Env |
checkClassDeclStmt(Env e,
ClassDeclStmt s)
|
protected Expr |
checkClassLiteralExpr(Env env,
ClassLiteral cl)
Typechecks a class literal (e.g., X which might appear as the rhs of instanceof). |
protected Expr |
checkCondExpr(Env env,
CondExpr ce)
Typechecks a conditional expression (e..g, a == 0 ? |
protected Expr |
checkDesignator(Env env,
Expr e)
|
protected Expr |
checkDoubleLitExpr(Expr x)
Typechecks doubles (e.g., 2.9). |
protected Expr |
checkExpr(Env env,
Expr x)
Typechecks expressions. |
protected Expr |
checkExpr(Env env,
Expr expr,
Type t)
Typechecks expressions. |
protected Type[] |
checkExprVec(Env env,
ExprVec ev)
|
protected FieldAccess |
checkFieldAccessExpr(Env env,
FieldAccess fa)
Typechecks a field access (e.g., this.x). |
void |
checkFieldDecl(FieldDecl fd)
Moves fd into implementation checked state. |
protected Expr |
checkFloatLitExpr(Expr x)
Typechecks floats (e.g., 2.9F). |
protected void |
checkForLoopAfterInit(Env se,
ForStmt f)
|
protected Expr |
checkIncDecExpr(Env env,
UnaryExpr ue)
Typecheck unary increment and decrement operators (e.g., ++x). |
protected VarInit |
checkInit(Env env,
VarInit x,
Type expectedResult)
|
protected Expr |
checkInstanceOfExpr(Env env,
InstanceOfExpr ie)
Typechecks a dynamic type probe (e.g., x instanceof X). |
(package private) static boolean |
checkIntegralType(Expr e)
|
protected Expr |
checkIntLitExpr(Expr x)
Typechecks integers (e.g., 29). |
protected Expr |
checkLongLitExpr(Expr x)
Typechecks long literal expressions (e.g., 29L). |
protected MethodInvocation |
checkMethodInvocationExpr(Env env,
MethodInvocation mi)
Typecheck method invocation. |
protected Env |
checkModifierPragma(ModifierPragma p,
ASTNode ctxt,
Env env)
Hook to do additional processing on Modifiers. |
protected Env |
checkModifierPragmaVec(ModifierPragmaVec v,
ASTNode ctxt,
Env env)
Hook to do additional processing on ModifierVecs. |
protected Expr |
checkNewArrayExpr(Env env,
NewArrayExpr na)
Typecheck a new array construction (e.g., new int[100]). |
protected NewInstanceExpr |
checkNewInstanceExpr(Env env,
NewInstanceExpr ne)
Typecheck a class instantiation (e.g., new C()). |
protected void |
checkNoRepInStaticContext(ASTNode n)
|
protected Expr |
checkNotExpr(Env env,
UnaryExpr ue)
Typecheck boolean not (e.g., ! |
protected Expr |
checkNullLitExpr(Expr x)
Typechecks null. |
(package private) static boolean |
checkNumericType(Expr e)
|
protected Type |
checkObjectDesignator(Env env,
ObjectDesignator od)
|
protected Expr |
checkParenExpr(Env env,
ParenExpr pe)
Typechecks paranthesis. |
protected Expr |
checkSignExpr(Env env,
UnaryExpr ue)
Typecheck sign (e.g. |
protected Env |
checkStmt(Env e,
Stmt s)
Typecheck a statement in a given environment then return the environment in effect for statements that follow the given statement. |
protected Env |
checkStmtPragma(Env e,
StmtPragma s)
|
protected Env |
checkStmtVec(Env env,
StmtVec v)
|
protected Expr |
checkStringLitExpr(Expr x)
Typechecks strings. |
protected Env |
checkSwitchStmt(Env e,
SwitchStmt s)
|
protected Expr |
checkThisExpr(Env env,
ThisExpr e)
Typechecks this expression. |
(package private) static void |
checkType(Expr expr,
Type t)
|
void |
checkTypeDeclaration(TypeSig s)
Moves s into implementation checked state. |
protected void |
checkTypeDeclElem(TypeDeclElem e)
|
protected void |
checkTypeDeclElemPragma(TypeDeclElemPragma e)
|
protected Env |
checkTypeModifierPragma(TypeModifierPragma p,
ASTNode ctxt,
Env env)
|
protected Env |
checkTypeModifierPragmaVec(TypeModifierPragmaVec v,
ASTNode ctxt,
Env env)
|
protected Env |
checkTypeModifiers(Env env,
Type t)
This may be called more than once on a Type t. |
static void |
checkUniverseAssignability(ASTNode l,
ASTNode r)
Tests if universe modifiers of r can be
assigned to l. |
static void |
checkUniverseCastability(ASTNode l,
ASTNode r)
Tests if the cast of the universe modifiers l
r is ever possible. |
protected void |
checkUniverseForField(GenericVarDecl gvd)
|
protected Env |
checkVarDeclStmt(Env e,
LocalVarDecl s)
|
protected Expr |
checkVariableAccessExpr(VariableAccess lva)
Typecheck variable access. |
static void |
copyUniverses(ASTNode dest,
ASTNode source)
|
static void |
determineUniverseForArrayRefExpr(ArrayRefExpr r)
|
static void |
determineUniverseForFieldAccess(FieldAccess fa)
|
void |
determineUniverseForMethodInvocation(MethodInvocation mi)
|
(package private) static Stmt |
getBranchLabel(BranchStmt s)
Retrieves the Stmt target of a BranchStmt. |
static Type |
getType(VarInit i)
Retrieves the Type of a VarInit. |
protected static Type |
getTypeOrNull(VarInit i)
Retrieves the Type of a VarInit. |
private static void |
initTypeDecoration()
|
static FlowInsensitiveChecks |
inst()
|
protected boolean |
isPure(RoutineDecl rd)
|
(package private) static boolean |
isVariable(Expr e)
|
static int |
leastUpperUniverseBound(int l,
int r)
|
protected EnvForTypeSig |
makeEnvForTypeSig(TypeSig s,
boolean staticContext)
Factory method so subclasses can override. |
protected static void |
reportLookupException(LookupException e,
java.lang.String s,
java.lang.String t,
int loc)
|
private static void |
setBranchLabel(BranchStmt s,
Stmt l)
|
static VarInit |
setType(VarInit i,
Type t)
|
private Type |
tryCondExprMatch(Expr leftExpr,
Expr rightExpr)
Return the type of a E1 : L ? |
static boolean |
universeIsSubtypeOf(int sub,
int sup)
Tests if the universe modifier sub is a subtype of
the universe modifier sup. |
protected static int |
universeTypeCombiner(ASTNode left,
ASTNode right)
|
protected static int |
universeTypeCombiner(int l,
int r)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static FlowInsensitiveChecks inst
public static boolean dontAddImplicitConstructorInvocations
protected boolean useUniverses
boolean readonlyStdForPureCtor
boolean inPure
boolean inCtor
boolean inStatic
int universeReturnType
int universeElementReturnType
protected TypeSig sig
protected EnvForTypeSig rootIEnv
protected EnvForTypeSig rootSEnv
protected boolean leftToRight
protected Type returnType
protected TypeSigVec allowedExceptions
protected StmtVec enclosingLabels
private static ASTDecoration typeDecoration
VarInit nodes to point to Type objects.
private static ASTDecoration branchDecoration
BranchStmt nodes to point to labelled Stmt
objects.
boolean impl_peerInStaticCautionThrown
| Constructor Detail |
protected FlowInsensitiveChecks()
| Method Detail |
public static FlowInsensitiveChecks inst()
protected EnvForTypeSig makeEnvForTypeSig(TypeSig s,
boolean staticContext)
public void checkTypeDeclaration(TypeSig s)
s into implementation checked state.
public void checkFieldDecl(FieldDecl fd)
fd into implementation checked state.
public static void checkUniverseAssignability(ASTNode l,
ASTNode r)
r can be
assigned to l.
public static void checkUniverseCastability(ASTNode l,
ASTNode r)
l
r is ever possible.
public static boolean universeIsSubtypeOf(int sub,
int sup)
sub is a subtype of
the universe modifier sup.
protected void checkTypeDeclElem(TypeDeclElem e)
protected Env checkVarDeclStmt(Env e,
LocalVarDecl s)
protected Env checkClassDeclStmt(Env e,
ClassDeclStmt s)
protected Env checkSwitchStmt(Env e,
SwitchStmt s)
protected Env checkStmt(Env e,
Stmt s)
(The returned environment will be the same as the one passed in unless the statement is a declaration.)
protected void checkForLoopAfterInit(Env se,
ForStmt f)
protected Env checkStmtVec(Env env,
StmtVec v)
protected Type[] checkExprVec(Env env,
ExprVec ev)
protected VarInit checkInit(Env env,
VarInit x,
Type expectedResult)
protected Expr checkDesignator(Env env,
Expr e)
protected Expr checkExpr(Env env,
Expr expr,
Type t)
env - The current environment.expr - The expression to be checked.t - The expected type.
protected Expr checkExpr(Env env,
Expr x)
env - The current environment.x - The expression to typecheck.
protected Expr checkVariableAccessExpr(VariableAccess lva)
lva - The variable access.
protected MethodInvocation checkMethodInvocationExpr(Env env,
MethodInvocation mi)
env - The current environment.mi - The method invocation.
protected Expr checkAmbiguousMethodInvocationExpr(Env env,
AmbiguousMethodInvocation ami)
env - The current environment.ami - The ambiguous method invocation.
protected FieldAccess checkFieldAccessExpr(Env env,
FieldAccess fa)
env - The current environment.fa - The field access.
protected Expr checkAmbiguousVariableAccessExpr(Env env,
AmbiguousVariableAccess av)
env - The current environment.av - The variable access.
protected Expr checkParenExpr(Env env,
ParenExpr pe)
env - The current environment.pe - The paranthesis expression.
protected Expr checkNotExpr(Env env,
UnaryExpr ue)
env - The current environment.ue - The unary expression containing the boolean not operation.
protected Expr checkIncDecExpr(Env env,
UnaryExpr ue)
env - The current environment.ue - The unary expression representing the inc(dec)rement.
protected Expr checkBitnotExpr(Env env,
UnaryExpr ue)
env - The current environment.ue - The unary expression representing bitwise negation.
protected Expr checkSignExpr(Env env,
UnaryExpr ue)
env - The current environment;ue - The unary expression representing the sign.
protected Expr checkAssignmentExpr(Env env,
BinaryExpr be)
env - The current environment.be - The binary expression representing the assignment.
protected Expr checkBinaryExpr(Env env,
BinaryExpr be)
env - The current environment.be - The simple binary expression.
protected Expr checkClassLiteralExpr(Env env,
ClassLiteral cl)
env - The current environment.cl - The class literal to check.
protected CastExpr checkCastExpr(Env env,
CastExpr ce)
env - The current environment.ce - The cast to be checked.
protected Expr checkInstanceOfExpr(Env env,
InstanceOfExpr ie)
env - The current environment.ie - The instance of expression.
protected Expr checkCondExpr(Env env,
CondExpr ce)
env - The current environment.ce - The expression to check.
protected Expr checkNewArrayExpr(Env env,
NewArrayExpr na)
env - The current environment.na - The expression to check.
protected NewInstanceExpr checkNewInstanceExpr(Env env,
NewInstanceExpr ne)
env - The current environment.ne - The instantiotion to check.
protected ArrayRefExpr checkArrayRefExpr(Env env,
ArrayRefExpr r)
env - The current environment.r - The expression to check.
protected Expr checkNullLitExpr(Expr x)
x - The null expression.
protected Expr checkLongLitExpr(Expr x)
x - The literal.
protected Expr checkIntLitExpr(Expr x)
x - The literal.
protected Expr checkDoubleLitExpr(Expr x)
x - The literal.
protected Expr checkFloatLitExpr(Expr x)
x - The literal.
protected Expr checkBooleanLitExpr(Expr x)
x - The literal.
protected Expr checkCharLitExpr(Expr x)
x - The literal.
protected Expr checkStringLitExpr(Expr x)
x - The expression to be checked.
protected Expr checkThisExpr(Env env,
ThisExpr e)
env - The current environment.e - The expression to check.
protected Type checkObjectDesignator(Env env,
ObjectDesignator od)
private Type tryCondExprMatch(Expr leftExpr,
Expr rightExpr)
protected Type checkBinaryExpr(int op,
Expr left,
Expr right,
int loc)
static boolean checkIntegralType(Expr e)
static boolean checkNumericType(Expr e)
static boolean isVariable(Expr e)
private static void initTypeDecoration()
public static VarInit setType(VarInit i,
Type t)
protected static Type getTypeOrNull(VarInit i)
Type of a VarInit. This type is
associated with an expression by the typechecking pass. If the expression does
not have an associated type, then null is returned.
public static Type getType(VarInit i)
Type of a VarInit. This type is
associated with an expression by the typechecking pass. If the expression does
not have an associated type, then Assert.fail is called.
private static void setBranchLabel(BranchStmt s,
Stmt l)
static Stmt getBranchLabel(BranchStmt s)
Stmt target of a BranchStmt. This
Stmt may be mentioned either explicitly (as in break
label;), or implicitly (as in break;) by the
BranchStmt. The correct Stmt target is associated
with the BranchStmt by the typechecking pass. This type is
associated with an expression by the typechecking pass. If the
BranchStmt does not have an associated Stmt target,
then Assert.fail is called.
static void checkType(Expr expr,
Type t)
protected static void reportLookupException(LookupException e,
java.lang.String s,
java.lang.String t,
int loc)
protected boolean assignmentConvertable(Expr e,
Type t)
Types, because it needs to mess with constants.
protected void checkTypeDeclElemPragma(TypeDeclElemPragma e)
protected Env checkModifierPragmaVec(ModifierPragmaVec v,
ASTNode ctxt,
Env env)
ModifierVecs. The
ASTNode is the parent of the ModifierPragma, and
env is the current environment.
protected Env checkModifierPragma(ModifierPragma p,
ASTNode ctxt,
Env env)
Modifiers. The
ASTNode is the parent of the ModifierPragma, and
env is the current environment.
protected Env checkStmtPragma(Env e,
StmtPragma s)
protected Env checkTypeModifierPragmaVec(TypeModifierPragmaVec v,
ASTNode ctxt,
Env env)
protected Env checkTypeModifierPragma(TypeModifierPragma p,
ASTNode ctxt,
Env env)
protected Env checkTypeModifiers(Env env,
Type t)
protected boolean isPure(RoutineDecl rd)
protected static int universeTypeCombiner(int l,
int r)
protected static int universeTypeCombiner(ASTNode left,
ASTNode right)
protected void checkNoRepInStaticContext(ASTNode n)
protected void checkUniverseForField(GenericVarDecl gvd)
public static void copyUniverses(ASTNode dest,
ASTNode source)
public static int leastUpperUniverseBound(int l,
int r)
public static void determineUniverseForFieldAccess(FieldAccess fa)
public void determineUniverseForMethodInvocation(MethodInvocation mi)
public static void determineUniverseForArrayRefExpr(ArrayRefExpr r)
|
ESC/Java2 © 2003,2004,2005,2006 David Cok and Joseph Kiniry © 2005,2006 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||