74ef6d1740
Work towards https://github.com/dart-lang/sdk/issues/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 <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>