edu.rice.cs.dynamicjava.interpreter
Class ExpressionChecker

java.lang.Object
  extended by edu.rice.cs.dynamicjava.interpreter.ExpressionChecker

public class ExpressionChecker
extends Object

This tree visitor checks the typing rules for expressions and determines each expression's type. The following properties (from NodeProperties) are set:


Constructor Summary
ExpressionChecker(TypeContext ctx, Options options)
           
 
Method Summary
 Type check(Expression e)
           
 Type check(Expression e, Option<Type> expected)
           
 Type check(Expression e, Type expected)
           
 void checkConstructorCall(ConstructorCall node)
          Handle a valid constructor call: one that appears as the first line of a constructor.
 DJField checkEnumSwitchCase(Expression exp, Type enumT)
          Check an expression appearing as the switch case in an enum switch statement.
 Iterable<Type> checkList(Iterable<? extends Expression> l)
           
 Iterable<Type> checkList(Iterable<? extends Expression> l, Option<Type> expected)
           
 Iterable<Type> checkList(Iterable<? extends Expression> l, Type expected)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionChecker

public ExpressionChecker(TypeContext ctx,
                         Options options)
Method Detail

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 Iterable<Type> checkList(Iterable<? extends Expression> l)

checkList

public Iterable<Type> checkList(Iterable<? extends Expression> l,
                                Type expected)

checkList

public Iterable<Type> checkList(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.