Commit 74ef6d1
DAS plugins: Do not run lint rules or warnings unnecessarily
Work towards #61490
When a plugin re-resolves a library [1] via
`AnalysisSessionImpl.getResolvedLibrary`, which calls
`AnalysisDriver.getResolvedLibrary`, eventually we get down to
`LibraryAnalyzer.analyze`. This method contains the singular piece of
code that checks `AnalysisOptions.lint` and `AnalysisOptions.warning` [2].
A plugin re-resolves a library in order to parse the code, and ultimately resolve the library into a LibraryElement. It does _not_ use
any lint computed by `LibraryAnalyzer.analyze()`, nor any warnings, nor even any compile-time errors. So we should do our best to do the minimal amount of work that still gets us our LibraryElement.
Setting `AnalysisOptions.lint` and `AnalysisOptions.warning` reduces the
amount of work that `LibraryAnalyzer.analyze()` does.
[1]: https://github.com/dart-lang/sdk/blob/c11f9118692461f61570e1ee07b6f5fc43288bb0/pkg/analysis_server_plugin/lib/src/plugin_server.dart#L351
[2]: https://github.com/dart-lang/sdk/blob/c11f9118692461f61570e1ee07b6f5fc43288bb0/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart#L342-L359
Change-Id: I73413a6646b14ff3a01246470b00e0a3676c4b3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450365
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Samuel Rawlins <[email protected]>1 parent 8875f1a commit 74ef6d1
1 file changed
+31
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
326 | 350 | | |
327 | 351 | | |
328 | 352 | | |
| |||
668 | 692 | | |
669 | 693 | | |
670 | 694 | | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
671 | 702 | | |
672 | 703 | | |
673 | 704 | | |
| |||
0 commit comments