Commit 2b13268
Fine. Track constructor/method/top-level function APIs.
Fine-grained dependency tracking missed several element APIs and edge
cases. This change annotates and records usage of key properties on
`ConstructorElementImpl`, `MethodElementImpl`, and
`TopLevelFunctionElementImpl`, and extends the manifest/serialization to
capture relationships and inference state that affect API shape.
What’s included
- Add `@elementClass` and granular tracking on members:
- Mark identifiers and flags with `@trackedIncludedInId`.
- Mark getters like `firstFragment`, `fragments`, `lastFragment`,
`accept()`, `visitChildren()` as `@trackedDirectlyOpaque` and record
opaque API use.
- Mark derived properties as `@trackedIndirectly` and internal caches
as `@trackedInternal`.
- Expose `_fragments` lists so tracked access doesn’t bypass recording.
- Constructors:
- Track `isConst`, `isFactory`, `constantInitializers`.
- Persist and match `redirectedConstructor` and `superConstructor`
via new optional `ManifestElement` fields.
- Compute `isGenerative` as `!isFactory` to avoid fragment drift.
- Methods:
- Persist `isOperatorEqualWithParameterTypeFromObject`.
- Serialize `typeInferenceError` and surface it in manifests.
- Add binary I/O for `TopLevelInferenceError` (read/write/optional,
equality) and print it in result output.
- Extend `ManifestElement` with `encodeOptional()/readOptional()` and a
helper extension for matching/writing optionals.
- Update the result printer to show:
- Method flags and optional `typeInferenceError`.
- Constructor `redirectedConstructor` and `superConstructor`.
- Bump `AnalysisDriver.DATA_VERSION` to 547 to invalidate old caches.
- Minor fixes:
- Use `baseElement.firstFragmentLocation.libraryFragment!.source` when
wiring the diagnostic reporter in constant evaluation to align with
fragment locations.
Why
Clients of the fine-grained dependency system rely on accurate
identification and usage tracking of element APIs. Missing tracking for
fragments/visitors and absent manifest fields (constructor redirection/
super calls, method inference errors) could let incompatible API changes
slip past invalidation and requirement checks. Persisting these details
ensures correct cache keys, precise requirement verification, and more
actionable diagnostics.
Compatibility
- Data/summary format changes require a cache rebuild (version 547).
- No user-visible API changes.
Change-Id: Ifdc1a97e87dc6e2decabcf0d9a9c634825da6e85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/448900
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>1 parent fc1bd94 commit 2b13268
File tree
8 files changed
+773
-221
lines changed- pkg/analyzer
- lib/src
- dart
- analysis
- constant
- element
- error
- fine
- test/src/dart/analysis
8 files changed
+773
-221
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2811 | 2811 | | |
2812 | 2812 | | |
2813 | 2813 | | |
2814 | | - | |
| 2814 | + | |
2815 | 2815 | | |
2816 | 2816 | | |
2817 | 2817 | | |
| |||
0 commit comments