Commit 2946328
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 <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>1 parent a9ad870 commit 2946328
File tree
5 files changed
+867
-1275
lines changed- pkg/analyzer
- lib/src
- generated/testing
- test_utilities
- test
- generated
- src/dart/constant
5 files changed
+867
-1275
lines changedLines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| |||
0 commit comments