You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fine. Update PreferIsNotEmpty to use getGetter() instead of requesting all children.
Replace child enumeration with a targeted member lookup in the
`prefer_is_not_empty` rule. Instead of requesting all children to check
for `isNotEmpty`, the rule now calls `InterfaceElement.getGetter()` on
the declaring interface of `isEmpty`. This avoids recording an "opaque
API use" requirement and reduces unnecessary dependency tracking and
overhead.
Additionally, remove generic child-walking utilities from `ast.dart`
that were only used for this purpose.
Changes:
- In `prefer_is_not_empty.dart`, use
`InterfaceElement.getGetter('isNotEmpty')` instead of `getChildren`.
- Drop `getChildren`, `_visitChildren`, `ElementProcessor`, and the
visitor adapter from `ast.dart`, along with their imports.
- Remove the unused `../ast.dart` import from the rule and add the
precise `element.dart` import.
No functional changes to the lint’s intent: it still recommends
`isNotEmpty` for `Iterable` and `Map` types, but does so without walking
children, improving precision and performance of fine-grained tracking.
Found with https://dart-review.googlesource.com/c/sdk/+/446480
Change-Id: I1e0e9991aeba924b672d1216bed2669215ab20cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446580
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
0 commit comments