Chromium Code Reviews| Index: utils/kernel-service/kernel-service.dart |
| diff --git a/utils/kernel-service/kernel-service.dart b/utils/kernel-service/kernel-service.dart |
| index 5b7ca5031c378a729bd9740d5777ef6e21fe4d27..d50a481b1d6b9b95c038af657e985e33fe82f60d 100644 |
| --- a/utils/kernel-service/kernel-service.dart |
| +++ b/utils/kernel-service/kernel-service.dart |
| @@ -70,7 +70,7 @@ Future _processLoadRequest(request) async { |
| print("DFE: sdkSummary: ${sdkSummary}"); |
| } |
| - var errors = <String>[]; |
| + bool hasErrors = false; |
| var options = new CompilerOptions() |
| ..strongMode = strongMode |
| ..fileSystem = fileSystem |
| @@ -78,13 +78,21 @@ Future _processLoadRequest(request) async { |
| ..packagesFileUri = packagesUri |
| ..sdkSummary = sdkSummary |
| ..verbose = verbose |
| - ..onError = (CompilationError e) => errors.add(e.message); |
| + ..reportMessages = true |
| + ..onError = (CompilationMessage e) { |
| + if (e.severity == Severity.error) { |
| + hasErrors = true; |
| + } |
| + }; |
| CompilationResult result; |
| try { |
| Program program = await kernelForProgram(script, options); |
| - if (errors.isNotEmpty) { |
| - result = new CompilationResult.errors(errors); |
| + if (hasErrors) { |
|
ahe
2017/07/18 16:54:37
Something has regressed here, and I think we need
Siggi Cherem (dart-lang)
2017/07/18 22:50:44
I see, let's talk on our next sync up about this.
|
| + // Note: the compiler prints errors to the console, so we don't print |
| + // those messages again here. |
| + result = |
| + new CompilationResult.error("Compile-time errors found in $script"); |
| } else { |
| // We serialize the program excluding platform.dill because the VM has |
| // these sources built-in. Everything loaded as a summary in |
| @@ -185,7 +193,7 @@ abstract class CompilationResult { |
| factory CompilationResult.ok(Uint8List bytes) = _CompilationOk; |
| - factory CompilationResult.errors(List<String> errors) = _CompilationError; |
| + factory CompilationResult.error(String error) = _CompilationError; |
| factory CompilationResult.crash(Object exception, StackTrace stack) = |
| _CompilationCrash; |
| @@ -221,16 +229,14 @@ abstract class _CompilationFail extends CompilationResult { |
| } |
| class _CompilationError extends _CompilationFail { |
| - final List<String> errors; |
| + @override |
| + final String errorString; |
| - _CompilationError(this.errors); |
| + _CompilationError(this.errorString); |
| @override |
| Status get status => Status.error; |
| - @override |
| - String get errorString => errors.take(10).join('\n'); |
| - |
| String toString() => "_CompilationError(${errorString})"; |
| } |