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

Unified Diff: lib/src/rastask.dart

Issue 2204943003: Improve error reporting in batch mode. (Closed) Base URL: git@github.com:dart-lang/rasta.git@load_all_libs
Patch Set: Created 4 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/run_batch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/rastask.dart
diff --git a/lib/src/rastask.dart b/lib/src/rastask.dart
index a29f4f6c65f7f5223cb16fc308b7f2716d0c25f2..a12d2f40f5af817f6927e3f830f23847b046654f 100644
--- a/lib/src/rastask.dart
+++ b/lib/src/rastask.dart
@@ -11,11 +11,18 @@ import 'dart:io' show
File,
IOSink;
+import 'package:compiler/compiler_new.dart' show
+ Diagnostic;
+
+import 'package:compiler/src/diagnostics/diagnostic_listener.dart' show
+ DiagnosticMessage;
+
import 'package:compiler/src/common/tasks.dart' show
CompilerTask;
import 'package:compiler/src/elements/elements.dart' show
CompilationUnitElement,
+ Element,
LibraryElement;
import 'package:kernel/ast.dart' as ir;
@@ -61,6 +68,7 @@ abstract class Rastask extends CompilerTask {
Duration setupDuration;
Kernel kernel;
ir.Library coreLibrary;
+ bool hasCompileTimeErrors = false;
Rastask(CustomCompiler compiler, this.wallClock, this.globalOptions)
: super(compiler);
@@ -93,6 +101,7 @@ abstract class Rastask extends CompilerTask {
}
Future<ir.TreeNode> runOne(Options options) async {
+ hasCompileTimeErrors = false;
ir.Library library = await loadLibrary(options.input);
bool generateLibrary = options.generateLibrary;
@@ -141,6 +150,19 @@ abstract class Rastask extends CompilerTask {
});
});
}
+ Set<ir.Library> libraries = new Set<ir.Library>.from(
+ generateLibrary ? <ir.Library>[library] : program.libraries);
+ compiler.elementsWithCompileTimeErrors.forEach(
+ (Element element, List<DiagnosticMessage> messages) {
+ ir.Library library = kernel.libraries[element.library];
+ if (libraries.contains(library)) {
+ for (DiagnosticMessage diagnostic in messages) {
kasperl 2016/08/04 11:14:13 Can messages be empty? Maybe move hasCompileTimeEr
ahe 2016/08/04 11:32:45 I'll address this in a follow-up CL.
ahe 2016/08/04 12:15:32 Thank you, I've created CL 2213913002 for this.
+ hasCompileTimeErrors = true;
+ compiler.reportDiagnostic(
+ diagnostic, const <DiagnosticMessage>[], Diagnostic.ERROR);
+ }
+ }
+ });
return generateLibrary ? library : program;
}
« no previous file with comments | « no previous file | lib/src/run_batch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698