Commit 0931a60
[analyzer] Use FormalParameterElementOrMember when interfacing with shared code.
Change the analyzer's use of the following shared generic types so
that it supplies the type parameter `FormalParameterElementOrMember`
instead of `ParameterElementMixin` as the type it uses to represent
parameters of function types:
- `SharedFunctionTypeStructure`
- `TypeConstraintGenerator`
- `TypeConstraintGeneratorMixin`
`FormalParameterElementOrMember` is a new interface class that acts as
a common private base class for all the concrete subtypes of the
public API class `FormalParameterElement`.
This required adding a type cast in one place (in
`FunctionTypeImpl.sortedNamedParametersShared`). In other places, I
avoided type casts by tightening up some return types (for example,
`FieldFormalParameterElementImpl.element` now returns
`FieldFormalParameterElementImpl2` instead of
`FieldFormalParameterElement2`). The analyzer public API is unchanged,
though (for example, `FieldFormalParameterFragment.element` still has
a return type of `FieldFormalParameterElement2`), so clients should be
unaffected.
As a result of this change, it is no longer necessary for
`ParameterElementMixin` to implement the shared interface
`SharedNamedFunctionParameterStructure`. This interface is now
implemented by `FormalParameterElementOrMember`.
This is part of a larger arc of work to use types from the new
analyzer element model when interfacing with shared code.
Change-Id: I1ab5bf0607a80cbe30f4814bd5444487099825ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402341
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Paul Berry <[email protected]>1 parent e2219ef commit 0931a60
File tree
5 files changed
+48
-24
lines changed- pkg/analyzer
- lib/src/dart/element
- test/generated
5 files changed
+48
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4400 | 4400 | | |
4401 | 4401 | | |
4402 | 4402 | | |
4403 | | - | |
4404 | | - | |
| 4403 | + | |
| 4404 | + | |
4405 | 4405 | | |
4406 | 4406 | | |
4407 | 4407 | | |
| |||
4428 | 4428 | | |
4429 | 4429 | | |
4430 | 4430 | | |
4431 | | - | |
| 4431 | + | |
4432 | 4432 | | |
4433 | 4433 | | |
4434 | 4434 | | |
| |||
4453 | 4453 | | |
4454 | 4454 | | |
4455 | 4455 | | |
4456 | | - | |
| 4456 | + | |
4457 | 4457 | | |
4458 | 4458 | | |
4459 | 4459 | | |
| |||
4551 | 4551 | | |
4552 | 4552 | | |
4553 | 4553 | | |
| 4554 | + | |
| 4555 | + | |
| 4556 | + | |
4554 | 4557 | | |
4555 | 4558 | | |
4556 | 4559 | | |
| |||
4588 | 4591 | | |
4589 | 4592 | | |
4590 | 4593 | | |
| 4594 | + | |
| 4595 | + | |
| 4596 | + | |
| 4597 | + | |
| 4598 | + | |
4591 | 4599 | | |
4592 | 4600 | | |
4593 | 4601 | | |
| |||
9029 | 9037 | | |
9030 | 9038 | | |
9031 | 9039 | | |
9032 | | - | |
| 9040 | + | |
9033 | 9041 | | |
9034 | 9042 | | |
9035 | 9043 | | |
| |||
9065 | 9073 | | |
9066 | 9074 | | |
9067 | 9075 | | |
9068 | | - | |
| 9076 | + | |
9069 | 9077 | | |
9070 | 9078 | | |
9071 | 9079 | | |
| |||
9080 | 9088 | | |
9081 | 9089 | | |
9082 | 9090 | | |
9083 | | - | |
| 9091 | + | |
9084 | 9092 | | |
9085 | 9093 | | |
9086 | 9094 | | |
| |||
9170 | 9178 | | |
9171 | 9179 | | |
9172 | 9180 | | |
9173 | | - | |
| 9181 | + | |
9174 | 9182 | | |
9175 | 9183 | | |
9176 | 9184 | | |
| |||
9241 | 9249 | | |
9242 | 9250 | | |
9243 | 9251 | | |
9244 | | - | |
9245 | | - | |
9246 | | - | |
9247 | | - | |
| 9252 | + | |
9248 | 9253 | | |
9249 | 9254 | | |
9250 | 9255 | | |
| |||
9269 | 9274 | | |
9270 | 9275 | | |
9271 | 9276 | | |
9272 | | - | |
9273 | | - | |
9274 | | - | |
9275 | 9277 | | |
9276 | 9278 | | |
9277 | 9279 | | |
| |||
10274 | 10276 | | |
10275 | 10277 | | |
10276 | 10278 | | |
10277 | | - | |
10278 | | - | |
| 10279 | + | |
| 10280 | + | |
10279 | 10281 | | |
10280 | 10282 | | |
10281 | 10283 | | |
| |||
10329 | 10331 | | |
10330 | 10332 | | |
10331 | 10333 | | |
10332 | | - | |
| 10334 | + | |
10333 | 10335 | | |
10334 | 10336 | | |
10335 | 10337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1079 | 1079 | | |
1080 | 1080 | | |
1081 | 1081 | | |
1082 | | - | |
| 1082 | + | |
1083 | 1083 | | |
1084 | 1084 | | |
1085 | 1085 | | |
| |||
1167 | 1167 | | |
1168 | 1168 | | |
1169 | 1169 | | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
1170 | 1173 | | |
1171 | 1174 | | |
1172 | 1175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
238 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
239 | 244 | | |
240 | 245 | | |
241 | 246 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1890 | 1890 | | |
1891 | 1891 | | |
1892 | 1892 | | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
1893 | 1907 | | |
1894 | 1908 | | |
1895 | 1909 | | |
| |||
0 commit comments