OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
8 | 8 |
9 import 'package:analyzer/context/context_root.dart'; | 9 import 'package:analyzer/context/context_root.dart'; |
10 import 'package:analyzer/context/declared_variables.dart'; | 10 import 'package:analyzer/context/declared_variables.dart'; |
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 file.exists, | 1208 file.exists, |
1209 content, | 1209 content, |
1210 file.lineInfo, | 1210 file.lineInfo, |
1211 signature, | 1211 signature, |
1212 resolvedUnit, | 1212 resolvedUnit, |
1213 errors, | 1213 errors, |
1214 unit.index); | 1214 unit.index); |
1215 } | 1215 } |
1216 | 1216 |
1217 /** | 1217 /** |
1218 * Return [AnalysisError]s for the given [serialized] errors. | 1218 * Return [AnalysisError]s for the given [serializedErrors]. |
1219 */ | 1219 */ |
1220 List<AnalysisError> _getErrorsFromSerialized( | 1220 List<AnalysisError> _getErrorsFromSerialized( |
1221 FileState file, List<AnalysisDriverUnitError> serialized) { | 1221 FileState file, List<AnalysisDriverUnitError> serializedErrors) { |
1222 return serialized.map((error) { | 1222 List<AnalysisError> errors = <AnalysisError>[]; |
1223 String errorName = error.uniqueName; | 1223 for (AnalysisDriverUnitError serializedError in serializedErrors) { |
| 1224 String errorName = serializedError.uniqueName; |
1224 ErrorCode errorCode = | 1225 ErrorCode errorCode = |
1225 errorCodeByUniqueName(errorName) ?? _lintCodeByUniqueName(errorName); | 1226 errorCodeByUniqueName(errorName) ?? _lintCodeByUniqueName(errorName); |
1226 if (errorCode == null) { | 1227 if (errorCode != null) { |
1227 // This could fail because the error code is no longer defined, or, in | 1228 errors.add(new AnalysisError.forValues( |
1228 // the case of a lint rule, if the lint rule has been disabled since the | 1229 file.source, |
1229 // errors were written. | 1230 serializedError.offset, |
1230 throw new StateError('No ErrorCode for $errorName in $file'); | 1231 serializedError.length, |
| 1232 errorCode, |
| 1233 serializedError.message, |
| 1234 serializedError.correction.isEmpty |
| 1235 ? null |
| 1236 : serializedError.correction)); |
1231 } | 1237 } |
1232 return new AnalysisError.forValues( | 1238 } |
1233 file.source, | 1239 return errors; |
1234 error.offset, | |
1235 error.length, | |
1236 errorCode, | |
1237 error.message, | |
1238 error.correction.isEmpty ? null : error.correction); | |
1239 }).toList(); | |
1240 } | 1240 } |
1241 | 1241 |
1242 /** | 1242 /** |
1243 * Return the key to store fully resolved results for the [signature]. | 1243 * Return the key to store fully resolved results for the [signature]. |
1244 */ | 1244 */ |
1245 String _getResolvedUnitKey(String signature) { | 1245 String _getResolvedUnitKey(String signature) { |
1246 return '$signature.resolved'; | 1246 return '$signature.resolved'; |
1247 } | 1247 } |
1248 | 1248 |
1249 /** | 1249 /** |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 libraryDeclarations.add(new TopLevelDeclarationInSource( | 2069 libraryDeclarations.add(new TopLevelDeclarationInSource( |
2070 file.source, declaration, isExported)); | 2070 file.source, declaration, isExported)); |
2071 } | 2071 } |
2072 } | 2072 } |
2073 } | 2073 } |
2074 | 2074 |
2075 // We're not done yet. | 2075 // We're not done yet. |
2076 return false; | 2076 return false; |
2077 } | 2077 } |
2078 } | 2078 } |
OLD | NEW |