Index: pkg/analyzer/lib/src/dart/analysis/driver.dart |
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
index 2b397795f932f23ae63b1ca7262ea0ef0ee01714..a655e73f6ebca964fd0c9b642074813894239ab8 100644 |
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart |
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
@@ -716,15 +716,15 @@ class AnalysisDriver { |
FileState libraryFile, FileState file, List<int> bytes, |
{String content, CompilationUnit resolvedUnit}) { |
var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes); |
- List<AnalysisError> errors = unit.errors |
- .map((error) => new AnalysisError.forValues( |
- file.source, |
- error.offset, |
- error.length, |
- errorCodeByUniqueName(error.uniqueName), |
- error.message, |
- error.correction)) |
- .toList(); |
+ List<AnalysisError> errors = unit.errors.map((error) { |
+ String errorName = error.uniqueName; |
+ ErrorCode errorCode = errorCodeByUniqueName(errorName); |
+ if (errorCode == null) { |
+ throw new StateError('No ErrorCode for $errorName in $file'); |
+ } |
+ return new AnalysisError.forValues(file.source, error.offset, |
+ error.length, errorCode, error.message, error.correction); |
+ }).toList(); |
return new AnalysisResult( |
libraryFile, |
file, |