Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 2903303002: Fix a recent regression with nested contexts (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index ec1d96b1ed928055cd2c7aaf29168c35f24668ca..843d50de4bdf9f74c8222fa57ff0dc97be6c83ab 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -686,8 +686,12 @@ class AnalysisServer {
* one exists, otherwise the first driver, otherwise `null`.
*/
nd.AnalysisDriver getAnalysisDriver(String path) {
- Iterable<nd.AnalysisDriver> drivers = driverMap.values;
+ List<nd.AnalysisDriver> drivers = driverMap.values.toList();
if (drivers.isNotEmpty) {
+ // Sort the drivers so that more deeply nested contexts will be checked
+ // before enclosing contexts.
+ drivers.sort((first, second) =>
+ second.contextRoot.root.length - first.contextRoot.root.length);
nd.AnalysisDriver driver = drivers.firstWhere(
(driver) => driver.contextRoot.containsFile(path),
orElse: () => null);
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_abstract.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698