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

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

Issue 455863003: Fixes for adding/removing pubspecs to/from roots. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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/context_manager_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/context_manager.dart
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 73ae4c96fa56c9b3f93c68b3b9ca6deadb92b78c..18e5136e67b63c64ee79a471cf7d7aec7359f5a6 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -263,8 +263,8 @@ abstract class ContextManager {
break;
}
Resource resource = resourceProvider.getResource(path);
- // pubspec was added, extract a new context
- if (_isPubspec(path)) {
+ // pubspec was added in a sub-folder, extract a new context
+ if (_isPubspec(path) && info.isRoot && !info.isPubspec(path)) {
_extractContext(info, resource);
return;
}
@@ -284,7 +284,7 @@ abstract class ContextManager {
break;
case ChangeType.REMOVE:
// pubspec was removed, merge the context into its parent
- if (info.isPubspec(path)) {
+ if (info.isPubspec(path) && !info.isRoot) {
_mergeContext(info);
return;
}
@@ -450,6 +450,11 @@ class _ContextInfo {
}
/**
+ * Returns `true` if this context is root folder based.
+ */
+ bool get isRoot => parent == null;
+
+ /**
* Returns `true` if [path] is excluded, as it is in one of the children.
*/
bool excludes(String path) {
« no previous file with comments | « no previous file | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698