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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 3002123002: Ignore missing error codes, but report them (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 [serialized] errors.
1219 */ 1219 */
1220 List<AnalysisError> _getErrorsFromSerialized( 1220 List<AnalysisError> _getErrorsFromSerialized(
1221 FileState file, List<AnalysisDriverUnitError> serialized) { 1221 FileState file, List<AnalysisDriverUnitError> serialized) {
1222 return serialized.map((error) { 1222 List<AnalysisError> errors = <AnalysisError>[];
1223 for (AnalysisDriverUnitError error in serialized) {
1223 String errorName = error.uniqueName; 1224 String errorName = error.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 // This could fail because the error code is no longer defined, or, in
1228 // the case of a lint rule, if the lint rule has been disabled since the 1229 // the case of a lint rule, if the lint rule has been disabled since the
1229 // errors were written. 1230 // errors were written.
1230 throw new StateError('No ErrorCode for $errorName in $file'); 1231 AnalysisEngine.instance.instrumentationService
1232 .logError('No error code for "$error" in "$file"');
1233 } else {
1234 errors.add(new AnalysisError.forValues(
1235 file.source,
1236 error.offset,
1237 error.length,
1238 errorCode,
1239 error.message,
1240 error.correction.isEmpty ? null : error.correction));
1231 } 1241 }
1232 return new AnalysisError.forValues( 1242 }
1233 file.source, 1243 return errors;
1234 error.offset,
1235 error.length,
1236 errorCode,
1237 error.message,
1238 error.correction.isEmpty ? null : error.correction);
1239 }).toList();
1240 } 1244 }
1241 1245
1242 /** 1246 /**
1243 * Return the key to store fully resolved results for the [signature]. 1247 * Return the key to store fully resolved results for the [signature].
1244 */ 1248 */
1245 String _getResolvedUnitKey(String signature) { 1249 String _getResolvedUnitKey(String signature) {
1246 return '$signature.resolved'; 1250 return '$signature.resolved';
1247 } 1251 }
1248 1252
1249 /** 1253 /**
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 libraryDeclarations.add(new TopLevelDeclarationInSource( 2073 libraryDeclarations.add(new TopLevelDeclarationInSource(
2070 file.source, declaration, isExported)); 2074 file.source, declaration, isExported));
2071 } 2075 }
2072 } 2076 }
2073 } 2077 }
2074 2078
2075 // We're not done yet. 2079 // We're not done yet.
2076 return false; 2080 return false;
2077 } 2081 }
2078 } 2082 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698