Skip to content

Commit

Permalink
Use InterfaceType.asInstanceOf() in AddDiagnosticPropertyReference.
Browse files Browse the repository at this point in the history
R=brianwilkerson@google.com, pquitslund@google.com

Change-Id: Ic40accfcdb645dc0260965efaec1701d3e5548ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153950
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
  • Loading branch information
scheglov authored and commit-bot@chromium.org committed Jul 10, 2020
1 parent 5c1eee9 commit adb317e
Showing 1 changed file with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,25 +188,8 @@ class AddDiagnosticPropertyReference extends CorrectionProducer {
}

bool _isIterable(DartType type) {
if (type is! InterfaceType) {
return false;
}

ClassElement element = type.element;

bool isExactIterable(ClassElement element) {
return element?.name == 'Iterable' && element.library.isDartCore;
}

if (isExactIterable(element)) {
return true;
}
for (var type in element.allSupertypes) {
if (isExactIterable(type.element)) {
return true;
}
}
return false;
return type is InterfaceType &&
type.asInstanceOf(typeProvider.iterableElement) != null;
}

/// Return an instance of this class. Used as a tear-off in `FixProcessor`.
Expand Down

0 comments on commit adb317e

Please sign in to comment.