Skip to content

Commit 5c1eee9

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Simplify _InvalidAccessVerifier._hasTypeOrSuperType().
[email protected] Change-Id: I4855170939bf8dc89afdc3dd4d7a91c4819e5667 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153948 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent e52a8be commit 5c1eee9

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

pkg/analyzer/lib/src/error/best_practices_verifier.dart

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,18 +1609,7 @@ class _InvalidAccessVerifier {
16091609
if (element == null) {
16101610
return false;
16111611
}
1612-
if (element == superElement) {
1613-
return true;
1614-
}
1615-
// TODO(scheglov) `allSupertypes` is very expensive
1616-
var allSupertypes = element.allSupertypes;
1617-
for (var i = 0; i < allSupertypes.length; i++) {
1618-
var supertype = allSupertypes[i];
1619-
if (supertype.element == superElement) {
1620-
return true;
1621-
}
1622-
}
1623-
return false;
1612+
return element.thisType.asInstanceOf(superElement) != null;
16241613
}
16251614

16261615
bool _hasVisibleForTemplate(Element element) {

0 commit comments

Comments
 (0)