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; |
} |