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. Avoid opaque API uses when lazily loading class members.
Lazy loading of a class’s members inadvertently recorded opaque API uses
via `ClassElementImpl.fragments`/`firstFragment`. This polluted result
requirements with non-API dependencies and could trigger unnecessary
rebuilds when reading from cached bundles.
This change removes those spurious dependencies:
- Add `ClassElementImpl._fragments` to iterate fragments without touching
the tracked `fragments` getter.
- Add `ClassElementImpl.ensureReadMembersForFragments()` and use it in
`BundleReader` when materializing a class’s members, avoiding any
dependency on `fragments` during deserialization.
- Simplify `LinkedElementFactory` by calling
`parentElement.ensureReadMembers()` instead of poking constructor lists
to force member loading.
- Keep the public `fragments` getter behavior (including opaque tracking)
for true API reads; internal reads now use the private helper.
A regression test exercises a scenario where class `B` references `A` in
a default parameter. Linking after a cache reload no longer records
opaque uses of `A`/`B` members, preserving dependency precision.
Found with https://dart-review.googlesource.com/c/sdk/+/446480
Change-Id: Ib8d2bea359956d1a24b1117bcb6840dfb3a68253
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446561
Reviewed-by: Paul Berry <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
0 commit comments