edu.rice.cs.dynamicjava.interpreter
Class ExpressionChecker
java.lang.Object
edu.rice.cs.dynamicjava.interpreter.ExpressionChecker
public class ExpressionChecker
- extends java.lang.Object
This tree visitor checks the typing rules for expressions and determines each expression's type.
The following properties (from NodeProperties) are set:
- TYPE on all
Expressions and on FormalParameters
- CONVERTED_TYPE on any
CastExpression subexpressions that require runtime conversion
- CHECKED_TYPE on any
CastExpression subexpressions, FieldAccesses, or
MethodCalls that require runtime checking
- ERASED_TYPE on all
ArrayAllocations, and ArrayInitializers,
and the nested type of TypeExpressions and InstanceofExpressions
- LEFT_EXPRESSION on assignments, increments, and decrements that access the left expression in
order to evaluate the right expression
- VARIABLE_TYPE on all lvalue expressions
- SUPER_TYPE on all AnonymousInnerAllocations
- VALUE on all constant expressions
- DJCLASS on
AnonymousAllocations, AnonymousInnerAllocations,
ThisExpressions, SuperMethodCalls, SuperFieldAccesses, and
non-static SimpleMethodCalls and SimpleFieldAccesses.
- CONSTRUCTOR on
ConstructorCalls and all allocations: SimpleAllocations,
InnerAllocations, AnonymousAllocations, and AnonymousInnerAllocations
- ENCLOSING_THIS on
SimpleAllocations and AnonymousAllocationss that represent
inner allocations with a "this" value of the given class as the enclosing object
- FIELD on all
FieldAccesses
- METHOD on all
MethodCalls
- VARIABLE on all
VariableAccesses, VariableDeclarations, and FormalParameters
- OPERATION on all
AddExpressions, AddAssignExpressions, EqualExpressions, and
NotEqualExpressions
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExpressionChecker
public ExpressionChecker(TypeContext ctx,
Options options)
check
public Type check(Expression e)
check
public Type check(Expression e,
Type expected)
check
public Type check(Expression e,
Option<Type> expected)
checkList
public java.lang.Iterable<Type> checkList(java.lang.Iterable<? extends Expression> l)
checkList
public java.lang.Iterable<Type> checkList(java.lang.Iterable<? extends Expression> l,
Type expected)
checkList
public java.lang.Iterable<Type> checkList(java.lang.Iterable<? extends Expression> l,
Option<Type> expected)
checkConstructorCall
public void checkConstructorCall(ConstructorCall node)
- Handle a valid constructor call: one that appears as the first line of a constructor.
ConstructorCalls handled via
check(Expression) will always be treated as errors.
checkEnumSwitchCase
public DJField checkEnumSwitchCase(Expression exp,
Type enumT)
- Check an expression appearing as the switch case in an enum switch statement.
- Returns:
- The field corresponding to the enum constant's value.