* @param newVars optional new variables to assign to
         * @param info source info to apply to created assignments
         * @return statement with assignments or null if none
         */
        private Statement createCasts(Scope scope,
                                      Variable[] newVars,
                                      SourceInfo info) {
            if (newVars == null) {
                return null;
            }

            int length = newVars.length;
            if (length == 0) {
                return null;
            }

            List<Statement> newStatements = new ArrayList<Statement>(length);

            for (int i=0; i<length; i++) {
                Variable newVar = newVars[i];
                String name = newVar.getName();
                Variable oldVar = scope.getDeclaredVariable(name);

                // It is important that the variable be declared private.
                newVar = scope.declareVariable(newVar, true);

                if (newVar == oldVar) {
                    continue;
                }

                VariableRef lvalue = new VariableRef(info, name);
                scope.bindToVariable(lvalue);
                lvalue.setVariable(newVar);

                VariableRef rvalue = new VariableRef(info, name);
                scope.bindToVariable(rvalue);
                rvalue.setVariable(oldVar);
                try {
                    rvalue.convertTo(newVar.getType(), true);
                }
                catch (IllegalArgumentException e) {
                    if (mErrorCount == 0) {
                        throw e;
                    }
                }

                newStatements.add
                    (new AssignmentStatement(info, lvalue, rvalue));
            }

            if (newStatements.size() == 0) {
                return null;
            }
            else {
                Statement[] stmts = new Statement[newStatements.size()];
                stmts = newStatements.toArray(stmts);
                return new StatementList(info, stmts);
            }
        }