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

Unified Diff: pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart

Issue 2531333006: Avoid a crash during summary linking when there are inheritance errors. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/link.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
diff --git a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
index 57c416912aaca0b7c5c5314d4dd2fa8225bfe1a3..a6300f8aff19610386c1a58e049a367507126888 100644
--- a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
@@ -54,12 +54,17 @@ class InheritanceManager {
new HashMap<ClassElement, Set<AnalysisError>>();
/**
+ * Indicates whether errors should be ignored.
Brian Wilkerson 2016/11/29 19:01:51 Please add an explanation for why we need to not g
Paul Berry 2016/11/29 19:03:45 Done.
+ */
+ final bool ignoreErrors;
+
+ /**
* Initialize a newly created inheritance manager.
*
* @param library the library element context that the inheritance mappings are being generated
*/
InheritanceManager(LibraryElement library,
- {bool includeAbstractFromSuperclasses: false}) {
+ {bool includeAbstractFromSuperclasses: false, this.ignoreErrors: false}) {
this._library = library;
_includeAbstractFromSuperclasses = includeAbstractFromSuperclasses;
_classLookup = new HashMap<ClassElement, Map<String, ExecutableElement>>();
@@ -654,15 +659,18 @@ class InheritanceManager {
* @param errorCode the error code to be associated with this error
* @param arguments the arguments used to build the error message
*/
- void _reportError(ClassElement classElt, int offset, int length,
- ErrorCode errorCode, List<Object> arguments) {
+ void _reportError(
+ ClassElement classElt, ErrorCode errorCode, List<Object> arguments) {
+ if (ignoreErrors) {
+ return;
+ }
HashSet<AnalysisError> errorSet = _errorsInClassElement[classElt];
Brian Wilkerson 2016/11/29 19:01:51 We could clean this up to use `putIfAbsent`, if yo
Paul Berry 2016/11/29 19:03:45 Acknowledged.
if (errorSet == null) {
errorSet = new HashSet<AnalysisError>();
_errorsInClassElement[classElt] = errorSet;
}
- errorSet.add(new AnalysisError(
- classElt.source, offset, length, errorCode, arguments));
+ errorSet.add(new AnalysisError(classElt.source, classElt.nameOffset,
+ classElt.nameLength, errorCode, arguments));
}
/**
@@ -793,8 +801,6 @@ class InheritanceManager {
"${executableElementTypes[0]}, ${executableElementTypes[1]}";
_reportError(
classElt,
- classElt.nameOffset,
- classElt.nameLength,
StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE,
[key, firstTwoFuntionTypesStr]);
}
@@ -823,8 +829,6 @@ class InheritanceManager {
} else {
_reportError(
classElt,
- classElt.nameOffset,
- classElt.nameLength,
StaticWarningCode
.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD,
[key]);
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/link.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698