Files
sdk/pkg/analyzer/lib/src/generated/testing
Konstantin Shcheglov 2946328e69 Element. Build mock SDK from declarative specifications.
The previous implementation of `MockSdkElements` was manually
constructed, resulting in over 1000 lines of code that was difficult to
maintain and extend.

This change refactors the mock SDK element creation by introducing a
generic, spec-based library builder. This builder uses declarative
specifications (`LibrarySpec`, `ClassSpec`, etc.) to construct the
corresponding element models.

`MockSdkElements` now defines the `dart:core` and `dart:async` libraries
as a simple, readable spec constant and uses the new builder to
construct them. This significantly reduces boilerplate and improves the
maintainability of the testing infrastructure.

The new mock SDK does not include everything that was there before,
because we don't need it, we need almost exclusively type hierarchies,
with a few exceptions.

Change-Id: I508e6c9d89be4766db0e0298bb4c52597deba1cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445120
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-08-13 13:37:29 -07:00
..