Skip to content

Commit adb317e

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Use InterfaceType.asInstanceOf() in AddDiagnosticPropertyReference.
[email protected], [email protected] Change-Id: Ic40accfcdb645dc0260965efaec1701d3e5548ed Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153950 Reviewed-by: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 5c1eee9 commit adb317e

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -188,25 +188,8 @@ class AddDiagnosticPropertyReference extends CorrectionProducer {
188188
}
189189

190190
bool _isIterable(DartType type) {
191-
if (type is! InterfaceType) {
192-
return false;
193-
}
194-
195-
ClassElement element = type.element;
196-
197-
bool isExactIterable(ClassElement element) {
198-
return element?.name == 'Iterable' && element.library.isDartCore;
199-
}
200-
201-
if (isExactIterable(element)) {
202-
return true;
203-
}
204-
for (var type in element.allSupertypes) {
205-
if (isExactIterable(type.element)) {
206-
return true;
207-
}
208-
}
209-
return false;
191+
return type is InterfaceType &&
192+
type.asInstanceOf(typeProvider.iterableElement) != null;
210193
}
211194

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

0 commit comments

Comments
 (0)