/** Compile a file. If you want a dump then give -out somefile. */ public static int compilerPhases(List<String> args, Option<String> out, String phase) throws UserError, InterruptedException, IOException, RepositoryError { int return_code = 0; if (args.size() == 0) { throw new UserError("The " + phase + " command must be given a file."); } String s = args.get(0); List<String> rest = args.subList(1, args.size()); if (s.startsWith("-")) { if (s.equals("-debug")) { rest = Debug.parseOptions(rest); } else if (s.equals("-out") && !rest.isEmpty()) { out = Option.<String>some(rest.get(0)); rest = rest.subList(1, rest.size()); } else if (s.equals("-compiler-lib")) { WellKnownNames.useCompilerLibraries(); Types.useCompilerLibraries(); } else if (s.equals("-typecheck-java")) { setScala(false); } else if (s.equals("-coercion")) { setTestCoercion(true); } else invalidFlag(s, phase); return_code = compilerPhases(rest, out, phase); } else { return_code = compileWithErrorHandling(s, out, false); } return return_code; }