Commit e3d218a
Elements. Standardize fragment APIs to XyzFragmentImpl across elements.
Replace uses of the generic Fragment/FunctionTypedFragment in element
APIs with their concrete *FragmentImpl counterparts. This makes the
element <-> fragment contract explicit, enforces invariants, and removes
a number of ad-hoc casts and hand-rolled fragment traversals.
Key changes:
- ElementImpl: make `firstFragment` abstract returning FragmentImpl and
specialize `fragments` to `List<FragmentImpl>`.
- Function-typed hierarchy: make ExecutableFragmentImpl extend
FunctionTypedFragmentImpl; make FunctionTypedFragmentImpl extend
FragmentImpl and expose `element`, `formalParameters`, and
`typeParameters`.
- Internal* mixins and concrete *ElementImpl classes: specialize
`firstFragment`/`fragments` to the corresponding *FragmentImpl types
(e.g., MethodFragmentImpl, SetterFragmentImpl, VariableFragmentImpl,
InstanceFragmentImpl, etc.).
- Substituted*ElementImpl: return `baseElement.fragments` directly and
tighten `firstFragment`/`fragments` to *FragmentImpl types to avoid
manual iteration and casts.
- Inheritance manager: drop redundant casts when mapping
parameters/type parameters; build result fragments using the concrete
*FragmentImpl types.
- Cleanup: remove unnecessary casts in constant-initializer handling and
detachment logic.
Behavior is unchanged; the API is now stricter and more consistent,
which prevents mixing arbitrary Fragment implementations with elements
and reduces boilerplate and casting throughout the codebase.
Change-Id: I9b90575affd7fe2ad3ac89a9dd7f145605619d2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447942
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Konstantin Shcheglov <[email protected]>1 parent 2765c75 commit e3d218a
File tree
4 files changed
+74
-85
lines changed- pkg/analyzer/lib/src
- dart/element
- summary2
4 files changed
+74
-85
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1699 | 1699 | | |
1700 | 1700 | | |
1701 | 1701 | | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
1702 | 1705 | | |
1703 | 1706 | | |
1704 | 1707 | | |
| |||
1710 | 1713 | | |
1711 | 1714 | | |
1712 | 1715 | | |
1713 | | - | |
1714 | | - | |
1715 | | - | |
1716 | | - | |
1717 | | - | |
1718 | | - | |
1719 | | - | |
1720 | | - | |
1721 | | - | |
1722 | | - | |
| 1716 | + | |
1723 | 1717 | | |
1724 | 1718 | | |
1725 | 1719 | | |
| |||
2208 | 2202 | | |
2209 | 2203 | | |
2210 | 2204 | | |
2211 | | - | |
| 2205 | + | |
2212 | 2206 | | |
2213 | 2207 | | |
2214 | 2208 | | |
| |||
3513 | 3507 | | |
3514 | 3508 | | |
3515 | 3509 | | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
| 3514 | + | |
| 3515 | + | |
3516 | 3516 | | |
3517 | 3517 | | |
3518 | 3518 | | |
| |||
3527 | 3527 | | |
3528 | 3528 | | |
3529 | 3529 | | |
3530 | | - | |
3531 | | - | |
| 3530 | + | |
| 3531 | + | |
| 3532 | + | |
| 3533 | + | |
| 3534 | + | |
| 3535 | + | |
| 3536 | + | |
| 3537 | + | |
3532 | 3538 | | |
3533 | 3539 | | |
3534 | | - | |
3535 | | - | |
3536 | | - | |
3537 | | - | |
| 3540 | + | |
3538 | 3541 | | |
3539 | 3542 | | |
3540 | 3543 | | |
| |||
3985 | 3988 | | |
3986 | 3989 | | |
3987 | 3990 | | |
| 3991 | + | |
| 3992 | + | |
| 3993 | + | |
3988 | 3994 | | |
3989 | 3995 | | |
3990 | 3996 | | |
| |||
5142 | 5148 | | |
5143 | 5149 | | |
5144 | 5150 | | |
| 5151 | + | |
| 5152 | + | |
| 5153 | + | |
5145 | 5154 | | |
5146 | 5155 | | |
5147 | 5156 | | |
| 5157 | + | |
| 5158 | + | |
| 5159 | + | |
5148 | 5160 | | |
5149 | 5161 | | |
5150 | 5162 | | |
| |||
5175 | 5187 | | |
5176 | 5188 | | |
5177 | 5189 | | |
| 5190 | + | |
| 5191 | + | |
| 5192 | + | |
| 5193 | + | |
| 5194 | + | |
| 5195 | + | |
5178 | 5196 | | |
5179 | 5197 | | |
5180 | 5198 | | |
| |||
5249 | 5267 | | |
5250 | 5268 | | |
5251 | 5269 | | |
| 5270 | + | |
| 5271 | + | |
| 5272 | + | |
| 5273 | + | |
| 5274 | + | |
| 5275 | + | |
5252 | 5276 | | |
5253 | 5277 | | |
5254 | 5278 | | |
| |||
5283 | 5307 | | |
5284 | 5308 | | |
5285 | 5309 | | |
| 5310 | + | |
| 5311 | + | |
| 5312 | + | |
| 5313 | + | |
| 5314 | + | |
| 5315 | + | |
5286 | 5316 | | |
5287 | 5317 | | |
5288 | 5318 | | |
| |||
10131 | 10161 | | |
10132 | 10162 | | |
10133 | 10163 | | |
10134 | | - | |
10135 | 10164 | | |
10136 | 10165 | | |
10137 | 10166 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1080 | 1080 | | |
1081 | 1081 | | |
1082 | 1082 | | |
1083 | | - | |
| 1083 | + | |
1084 | 1084 | | |
1085 | 1085 | | |
1086 | 1086 | | |
| |||
1131 | 1131 | | |
1132 | 1132 | | |
1133 | 1133 | | |
1134 | | - | |
| 1134 | + | |
1135 | 1135 | | |
1136 | 1136 | | |
1137 | 1137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 57 | + | |
65 | 58 | | |
66 | 59 | | |
67 | 60 | | |
| |||
187 | 180 | | |
188 | 181 | | |
189 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
190 | 189 | | |
191 | 190 | | |
192 | 191 | | |
| |||
317 | 316 | | |
318 | 317 | | |
319 | 318 | | |
320 | | - | |
| 319 | + | |
321 | 320 | | |
322 | 321 | | |
323 | 322 | | |
| |||
345 | 344 | | |
346 | 345 | | |
347 | 346 | | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
| 347 | + | |
| 348 | + | |
357 | 349 | | |
358 | 350 | | |
359 | 351 | | |
| |||
525 | 517 | | |
526 | 518 | | |
527 | 519 | | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
| 520 | + | |
536 | 521 | | |
537 | 522 | | |
538 | 523 | | |
| |||
685 | 670 | | |
686 | 671 | | |
687 | 672 | | |
688 | | - | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
689 | 676 | | |
690 | 677 | | |
691 | | - | |
| 678 | + | |
692 | 679 | | |
693 | 680 | | |
694 | 681 | | |
| |||
757 | 744 | | |
758 | 745 | | |
759 | 746 | | |
760 | | - | |
| 747 | + | |
761 | 748 | | |
762 | 749 | | |
763 | 750 | | |
764 | 751 | | |
765 | 752 | | |
766 | 753 | | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
| 754 | + | |
| 755 | + | |
776 | 756 | | |
777 | 757 | | |
778 | 758 | | |
| |||
936 | 916 | | |
937 | 917 | | |
938 | 918 | | |
939 | | - | |
940 | | - | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | | - | |
945 | | - | |
946 | | - | |
| 919 | + | |
947 | 920 | | |
948 | 921 | | |
949 | 922 | | |
| |||
1015 | 988 | | |
1016 | 989 | | |
1017 | 990 | | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
| 991 | + | |
1026 | 992 | | |
1027 | 993 | | |
1028 | 994 | | |
| |||
1173 | 1139 | | |
1174 | 1140 | | |
1175 | 1141 | | |
1176 | | - | |
1177 | | - | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
| 1142 | + | |
1184 | 1143 | | |
1185 | 1144 | | |
1186 | 1145 | | |
| |||
1248 | 1207 | | |
1249 | 1208 | | |
1250 | 1209 | | |
1251 | | - | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
1252 | 1213 | | |
1253 | 1214 | | |
1254 | | - | |
| 1215 | + | |
1255 | 1216 | | |
1256 | 1217 | | |
1257 | 1218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
| |||
0 commit comments