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
Add MissingSdkLibraryResult and centralize SDK checks
Introduce a dedicated result type, `MissingSdkLibraryResult`, returned
when required SDK libraries (e.g., `dart:core`, `dart:async`) are not
available. The analysis driver now detects missing SDK libraries early
and completes all pending requests for the affected library with this
typed result.
What changes
- New public API:
- `abstract class MissingSdkLibraryResult` (exposes `missingUri`)
- `MissingSdkLibraryResultImpl` implementation
- Driver behavior:
- New helper `_completeRequestsIfMissingSdkLibrary(...)` short-circuits
analysis when `dart:core` or `dart:async` is missing, completing:
- `getErrors`, `getResolvedUnit`, `getResolvedLibrary`,
`getUnitElement`, `getLibraryByUri` with `MissingSdkLibraryResult`
- `getIndex` with `null` for index data
- Removes duplicated per-call checks and ad-hoc error creation
- Result printing updated to render `MissingSdkLibraryResult`
- Old path that produced an `ErrorsResult` with a synthetic
`missingDartLibrary` diagnostic is removed
Why
- Provide a clear, explicit signal to callers that the SDK is incomplete
- Unify behavior across APIs and reduce duplicated logic
- Avoid relying on temporary diagnostics for a systemic environment issue
Behavioral / API notes
- Calls that previously could yield an `ErrorsResult` containing a
synthetic “missing SDK library” diagnostic will now return
`MissingSdkLibraryResult`. Clients should handle this result type and
surface the `missingUri` to users as appropriate.
Change-Id: Ib71ceb05269d5b9fe4276a03155278aef64daf56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447005
Reviewed-by: Brian Wilkerson <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>
0 commit comments