private Context translateAssign ( WyilFile . Stmt . Assign stmt , Context context ) { Tuple < WyilFile . LVal > lhs = stmt . getLeftHandSide ( ) ; Tuple < WyilFile . Expr > rhs = stmt . getRightHandSide ( ) ; WyilFile . LVal [ ] [ ] lvals = new LVal [ rhs . size ( ) ] [ ] ; Expr [ ] [ ] rvals = new Expr [ rhs . size ( ) ] [ ] ; // First, generate bundles for ( int i = 0 , j = 0 ; i != rhs . size ( ) ; ++ i ) { WyilFile . Expr rval = rhs . get ( i ) ; lvals [ i ] = generateEmptyLValBundle ( rval . getTypes ( ) , lhs , j ) ; j += lvals [ i ] . length ; Pair < Expr [ ] , Context > p = generateRValBundle ( rval , context ) ; rvals [ i ] = p . first ( ) ; context = p . second ( ) ; } // Second, apply the bundles to implement assignments. for ( int i = 0 ; i != rhs . size ( ) ; ++ i ) { context = translateAssign ( lvals [ i ] , rvals [ i ] , context ) ; } // Done return context ; }
Translate an assign statement . This updates the version number of the underlying assigned variable .