Commit 8191171
[analyzer] Use StatementImpl when interfacing with shared code
Change the analyzer's use of the following generic types so that it
supplies the type parameter `StatementImpl` instead of `Statement` as
the type of AST node it uses to represent statements:
- `FlowAnalysis`
- `TypeAnalyzerErrors`
This required adjusting some `is` tests to test against concrete
statement types instead of abstract public interface types (e.g. `is
SwitchStatementImpl` instead of `is SwitchStatement`). In one place
(in `FlowAnalysisHelper.getLabelTarget`) I changed an if-test to a
switch statement so that I could use pattern matching to avoid type
casts entirely.
In some places, I was able to avoid adding casts by changing method
parameters to accept concrete statement types instead of abstract
public interface types. This required adding the `covariant` keyword
to some methods.
This is part of a larger arc of work to change the analyzer's use of
the shared code so that the type parameters it supplies are not part
of the analyzer public API. See
#59763.
Change-Id: I8910184ff71ccb97b52e5d44fbf0b6bddd6e273b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403180
Commit-Queue: Paul Berry <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>1 parent 1c4d7e1 commit 8191171
File tree
3 files changed
+27
-23
lines changed- pkg/analyzer/lib/src
- dart/resolver
- generated
3 files changed
+27
-23
lines changedLines changed: 19 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
| 180 | + | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
| 189 | + | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
| 261 | + | |
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
| 375 | + | |
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
384 | 388 | | |
385 | 389 | | |
386 | | - | |
| 390 | + | |
387 | 391 | | |
388 | 392 | | |
389 | 393 | | |
| |||
399 | 403 | | |
400 | 404 | | |
401 | 405 | | |
402 | | - | |
| 406 | + | |
403 | 407 | | |
404 | 408 | | |
405 | 409 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
| 440 | + | |
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
| |||
995 | 995 | | |
996 | 996 | | |
997 | 997 | | |
998 | | - | |
| 998 | + | |
999 | 999 | | |
1000 | 1000 | | |
1001 | 1001 | | |
| |||
2452 | 2452 | | |
2453 | 2453 | | |
2454 | 2454 | | |
2455 | | - | |
| 2455 | + | |
2456 | 2456 | | |
2457 | 2457 | | |
2458 | 2458 | | |
| |||
3124 | 3124 | | |
3125 | 3125 | | |
3126 | 3126 | | |
3127 | | - | |
| 3127 | + | |
3128 | 3128 | | |
3129 | 3129 | | |
3130 | 3130 | | |
| |||
3922 | 3922 | | |
3923 | 3923 | | |
3924 | 3924 | | |
3925 | | - | |
| 3925 | + | |
3926 | 3926 | | |
3927 | 3927 | | |
3928 | 3928 | | |
| |||
0 commit comments