public static Expr . VariableAccess extractAssignedVariable ( LVal lval ) { if ( lval instanceof Expr . VariableAccess ) { return ( Expr . VariableAccess ) lval ; } else if ( lval instanceof Expr . RecordAccess ) { Expr . RecordAccess e = ( Expr . RecordAccess ) lval ; return extractAssignedVariable ( ( LVal ) e . getOperand ( ) ) ; } else if ( lval instanceof Expr . ArrayAccess ) { Expr . ArrayAccess e = ( Expr . ArrayAccess ) lval ; return extractAssignedVariable ( ( LVal ) e . getFirstOperand ( ) ) ; } else if ( lval instanceof Expr . Dereference ) { return null ; } else { syntaxError ( lval , WyilFile . INVALID_LVAL_EXPRESSION ) ; return null ; // dead code } }
Determine the modified variable for a given LVal . Almost all lvals modify exactly one variable though dereferences don t .