Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: compiler/java/com/google/dart/compiler/DartCompiler.java

Issue 9702034: Removes dartc reliance on its own libraries, now can be targeted at any implementation's libraries (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: junit tests fixed Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: compiler/java/com/google/dart/compiler/DartCompiler.java
diff --git a/compiler/java/com/google/dart/compiler/DartCompiler.java b/compiler/java/com/google/dart/compiler/DartCompiler.java
index 6968b104eb511739e82b33fe39ed6741d0e5fe60..8907ddba47f5f6449b89b7610ef7b45515c759d1 100644
--- a/compiler/java/com/google/dart/compiler/DartCompiler.java
+++ b/compiler/java/com/google/dart/compiler/DartCompiler.java
@@ -131,7 +131,6 @@ public class DartCompiler {
private final Map<URI, LibraryUnit> libraries = new LinkedHashMap<URI, LibraryUnit>();
private CoreTypeProvider typeProvider;
private final boolean incremental;
- private final boolean usePrecompiledDartLibs;
private final List<DartCompilationPhase> phases;
private final LibrarySource coreLibrarySource;
@@ -152,13 +151,12 @@ public class DartCompiler {
embeddedLibraries.add(coreLibrarySource);
incremental = config.incremental();
- usePrecompiledDartLibs = true;
}
-
+
void addResolvedLibraries(Map<URI, LibraryUnit> resolvedLibraries) {
libraries.putAll(resolvedLibraries);
}
-
+
Map<URI, LibraryUnit> getLibraries() {
return libraries;
}
@@ -254,7 +252,7 @@ public class DartCompiler {
}
if (!incremental
- || (libIsDartUri && !usePrecompiledDartLibs)
+ || libIsDartUri
|| isSourceOutOfDate(dartSrc)) {
DartUnit unit = parse(dartSrc, lib.getPrefixes(), false);
@@ -851,8 +849,8 @@ public class DartCompiler {
}
/**
- * Selectively compile a library. Use supplied libraries and ASTs when available.
- * This allows programming tools to provide customized ASTs for code that is currently being
+ * Selectively compile a library. Use supplied libraries and ASTs when available.
+ * This allows programming tools to provide customized ASTs for code that is currently being
* edited, and may not compile correctly.
*/
private static class SelectiveCompiler extends Compiler {
@@ -862,14 +860,14 @@ public class DartCompiler {
private Collection<LibraryUnit> librariesToProcess;
private SelectiveCompiler(LibrarySource app, Map<URI, LibraryUnit> resolvedLibraries,
- Map<URI,DartUnit> parsedUnits, CompilerConfiguration config,
+ Map<URI,DartUnit> parsedUnits, CompilerConfiguration config,
DartCompilerMainContext context) {
super(app, Collections.<LibrarySource>emptyList(), config, context);
this.resolvedLibraries = resolvedLibraries;
this.parsedUnits = parsedUnits;
addResolvedLibraries(resolvedLibraries);
}
-
+
@Override
Collection<LibraryUnit> getLibrariesToProcess() {
if (librariesToProcess == null) {
@@ -911,20 +909,31 @@ public class DartCompiler {
return compilerOptions;
}
- public static void main(String[] args) {
+ public static void main(final String[] topArgs) {
Tracer.init();
- CompilerOptions topCompilerOptions = processCommandLineOptions(args);
+ CompilerOptions topCompilerOptions = processCommandLineOptions(topArgs);
boolean result = false;
try {
if (topCompilerOptions.shouldBatch()) {
- if (args.length > 1) {
+ if (topArgs.length > 1) {
System.err.println("(Extra arguments specified with -batch ignored.)");
}
- UnitTestBatchRunner.runAsBatch(args, new Invocation() {
+ UnitTestBatchRunner.runAsBatch(topArgs, new Invocation() {
@Override
- public boolean invoke(String[] args) throws Throwable {
- CompilerOptions compilerOptions = processCommandLineOptions(args);
+ public boolean invoke(String[] lineArgs) throws Throwable {
+ List<String> allArgs = new ArrayList<String>();
+ for (String arg: topArgs) {
+ if (!arg.equals("-batch")) {
+ allArgs.add(arg);
+ }
+ }
+ for (String arg: lineArgs) {
+ allArgs.add(arg);
+ }
+
+ CompilerOptions compilerOptions = processCommandLineOptions(
+ allArgs.toArray(new String[allArgs.size()]));
if (compilerOptions.shouldBatch()) {
System.err.println("-batch ignored: Already in batch mode.");
}

Powered by Google App Engine
This is Rietveld 408576698