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

Unified Diff: lib/src/compiler.dart

Issue 1299993004: sort errors so they appear in stable order (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fix html messages Created 5 years, 4 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
« no previous file with comments | « no previous file | lib/src/report.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/compiler.dart
diff --git a/lib/src/compiler.dart b/lib/src/compiler.dart
index 6a97b1bd55801639e58daabf64712d34f5ce5c1f..91e97c88eacbc34c1b3e950572f83af21b4fdd37 100644
--- a/lib/src/compiler.dart
+++ b/lib/src/compiler.dart
@@ -84,7 +84,11 @@ class BatchCompiler extends AbstractCompiler {
BatchCompiler(AnalysisContext context, CompilerOptions options,
{AnalysisErrorListener reporter})
- : super(context, options, reporter) {
+ : super(
+ context,
+ options,
+ new ErrorCollector(
+ reporter ?? AnalysisErrorListener.NULL_LISTENER)) {
_inputBaseDir = options.inputBaseDir;
if (outputDir != null) {
_jsGen = new JSGenerator(this);
@@ -93,6 +97,8 @@ class BatchCompiler extends AbstractCompiler {
_dartCore = context.typeProvider.objectType.element.library;
}
+ ErrorCollector get reporter => checker.reporter;
+
void reset() {
_compiled.clear();
}
@@ -127,12 +133,13 @@ class BatchCompiler extends AbstractCompiler {
void compileSource(Source source) {
if (AnalysisEngine.isHtmlFileName(source.uri.path)) {
_compileHtml(source);
- return;
+ } else {
+ _compileLibrary(context.computeLibraryElement(source));
}
- compileLibrary(context.computeLibraryElement(source));
+ reporter.flush();
}
- void compileLibrary(LibraryElement library) {
+ void _compileLibrary(LibraryElement library) {
if (!_compiled.add(library)) return;
if (!options.checkSdk && library.source.uri.scheme == 'dart') {
@@ -142,9 +149,9 @@ class BatchCompiler extends AbstractCompiler {
// TODO(jmesserly): in incremental mode, we can skip the transitive
// compile of imports/exports.
- compileLibrary(_dartCore); // implicit dart:core dependency
- library.importedLibraries.forEach(compileLibrary);
- library.exportedLibraries.forEach(compileLibrary);
+ _compileLibrary(_dartCore); // implicit dart:core dependency
+ library.importedLibraries.forEach(_compileLibrary);
+ library.exportedLibraries.forEach(_compileLibrary);
var unitElements = [library.definingCompilationUnit]..addAll(library.parts);
var units = <CompilationUnit>[];
@@ -209,7 +216,7 @@ class BatchCompiler extends AbstractCompiler {
if (scriptSource != null) {
var lib = context.computeLibraryElement(scriptSource);
- compileLibrary(lib);
+ _compileLibrary(lib);
script.replaceWith(_linkLibraries(lib, loadedLibs, from: htmlOutDir));
}
}
@@ -272,7 +279,7 @@ abstract class AbstractCompiler {
: context = context,
options = options,
checker = createChecker(context.typeProvider, options.strongOptions,
- reporter == null ? AnalysisErrorListener.NULL_LISTENER : reporter) {
+ reporter ?? AnalysisErrorListener.NULL_LISTENER) {
enableDevCompilerInference(context, options.strongOptions);
}
« no previous file with comments | « no previous file | lib/src/report.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698