edu.rice.cs.javalanglevels
Class LValueWithValueTypeChecker

java.lang.Object
  extended by edu.rice.cs.javalanglevels.tree.JExpressionIFAbstractVisitor<TypeData>
      extended by edu.rice.cs.javalanglevels.LValueWithValueTypeChecker
All Implemented Interfaces:
JExpressionIFVisitor<TypeData>

public class LValueWithValueTypeChecker
extends JExpressionIFAbstractVisitor<TypeData>

Used to type check the LHS of an assignment expression such as += or -=, where the left hand side needs to not be final and already have a value.


Nested Class Summary
static class LValueWithValueTypeChecker.LValueWithValueTypeCheckerTest
          Test the methods defined in the above class
 
Constructor Summary
LValueWithValueTypeChecker(SpecialTypeChecker bob)
           
 
Method Summary
 TypeData defaultCase(JExpressionIF that)
          Most expressions cannot appear on the lhs of an assignment: give an appropriate error
 TypeData forArrayAccess(ArrayAccess that)
          Array accesses can appear on the lhs, so check to see if the array can be assigned to
 TypeData forIncrementExpression(IncrementExpression that)
          An increment expression is a special case that cannot appear on the lhs
 TypeData forNameReference(NameReference that)
           
 TypeData forParenthesized(Parenthesized that)
          Recur on the value stored in the parentheses
 
Methods inherited from class edu.rice.cs.javalanglevels.tree.JExpressionIFAbstractVisitor
forAbstractMethodDef, forAndExpression, forAnonymousClassInstantiation, forArrayInitializer, forArrayInstantiation, forArrayType, forAssignmentExpression, forBinaryExpression, forBitwiseAndAssignmentExpression, forBitwiseAndExpression, forBitwiseAssignmentExpression, forBitwiseBinaryExpression, forBitwiseNotExpression, forBitwiseOrAssignmentExpression, forBitwiseOrExpression, forBitwiseXorAssignmentExpression, forBitwiseXorExpression, forBlock, forBody, forBooleanExpression, forBooleanLiteral, forBracedBody, forBreakStatement, forCastExpression, forCatchBlock, forCharLiteral, forClassDef, forClassImportStatement, forClassInstantiation, forClassLiteral, forClassOrInterfaceType, forComparisonExpression, forComplexAnonymousClassInstantiation, forComplexInitializedArrayInstantiation, forComplexMethodInvocation, forComplexNamedClassInstantiation, forComplexNameReference, forComplexSuperConstructorInvocation, forComplexSuperReference, forComplexThisConstructorInvocation, forComplexThisReference, forComplexUninitializedArrayInstantiation, forCompoundWord, forConcreteMethodDef, forConditionalExpression, forConstructorDef, forContinueStatement, forDefaultCase, forDimensionExpressionList, forDivideAssignmentExpression, forDivideExpression, forDoStatement, forDoubleLiteral, forEmptyExpression, forEmptyForCondition, forEmptyStatement, forEqualityExpression, forEqualsExpression, forExpression, forExpressionList, forExpressionStatement, forFloatLiteral, forFormalParameter, forForStatement, forFunctionInvocation, forGreaterThanExpression, forGreaterThanOrEqualExpression, forIfThenElseStatement, forIfThenStatement, forImportStatement, forInitializedArrayInstantiation, forInitializedVariableDeclarator, forInitializer, forInnerClassDef, forInnerInterfaceDef, forInstanceInitializer, forInstanceofExpression, forInstantiation, forIntegerLiteral, forInterfaceDef, forJExpression, forLabeledBreakStatement, forLabeledCase, forLabeledContinueStatement, forLabeledStatement, forLeftShiftAssignmentExpression, forLeftShiftExpression, forLessThanExpression, forLessThanOrEqualExpression, forLexicalLiteral, forLongLiteral, forMemberType, forMethodDef, forMethodInvocation, forMinusAssignmentExpression, forMinusExpression, forModAssignmentExpression, forModExpression, forModifiersAndVisibility, forMultiplyAssignmentExpression, forMultiplyExpression, forNamedClassInstantiation, forNegativeExpression, forNegativePostfixIncrementExpression, forNegativePrefixIncrementExpression, forNoOpExpression, forNormalTryCatchStatement, forNotEqualExpression, forNotExpression, forNullLiteral, forNumericAssignmentExpression, forNumericBinaryExpression, forNumericUnaryExpression, forOrExpression, forPackageImportStatement, forPackageStatement, forParenthesizedExpressionList, forPlusAssignmentExpression, forPlusExpression, forPositiveExpression, forPositivePostfixIncrementExpression, forPositivePrefixIncrementExpression, forPostfixIncrementExpression, forPrefixIncrementExpression, forPrimary, forPrimitiveType, forReferenceType, forReturnStatement, forRightSignedShiftAssignmentExpression, forRightSignedShiftExpression, forRightUnsignedShiftAssignmentExpression, forRightUnsignedShiftExpression, forShiftAssignmentExpression, forShiftBinaryExpression, forSimpleAnonymousClassInstantiation, forSimpleAssignmentExpression, forSimpleInitializedArrayInstantiation, forSimpleMethodInvocation, forSimpleNamedClassInstantiation, forSimpleNameReference, forSimpleSuperConstructorInvocation, forSimpleSuperReference, forSimpleThisConstructorInvocation, forSimpleThisReference, forSimpleUninitializedArrayInstantiation, forSourceFile, forStatement, forStaticInitializer, forStringLiteral, forSuperConstructorInvocation, forSuperReference, forSwitchCase, forSwitchStatement, forSynchronizedStatement, forThisConstructorInvocation, forThisReference, forThrowStatement, forTryCatchFinallyStatement, forTryCatchStatement, forType, forTypeDefBase, forTypeParameter, forTypeVariable, forUnaryExpression, forUnbracedBody, forUninitializedArrayInstantiation, forUninitializedVariableDeclarator, forUnlabeledBreakStatement, forUnlabeledContinueStatement, forUnparenthesizedExpressionList, forValueReturnStatement, forVariableDeclaration, forVariableDeclarator, forVariableReference, forVoidReturn, forVoidReturnStatement, forWhileStatement, forWord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LValueWithValueTypeChecker

public LValueWithValueTypeChecker(SpecialTypeChecker bob)
Method Detail

defaultCase

public TypeData defaultCase(JExpressionIF that)
Most expressions cannot appear on the lhs of an assignment: give an appropriate error

Specified by:
defaultCase in class JExpressionIFAbstractVisitor<TypeData>

forIncrementExpression

public TypeData forIncrementExpression(IncrementExpression that)
An increment expression is a special case that cannot appear on the lhs

Overrides:
forIncrementExpression in class JExpressionIFAbstractVisitor<TypeData>

forNameReference

public TypeData forNameReference(NameReference that)
Overrides:
forNameReference in class JExpressionIFAbstractVisitor<TypeData>

forArrayAccess

public TypeData forArrayAccess(ArrayAccess that)
Array accesses can appear on the lhs, so check to see if the array can be assigned to

Specified by:
forArrayAccess in interface JExpressionIFVisitor<TypeData>
Overrides:
forArrayAccess in class JExpressionIFAbstractVisitor<TypeData>

forParenthesized

public TypeData forParenthesized(Parenthesized that)
Recur on the value stored in the parentheses

Specified by:
forParenthesized in interface JExpressionIFVisitor<TypeData>
Overrides:
forParenthesized in class JExpressionIFAbstractVisitor<TypeData>