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

Unified Diff: pkg/analyzer/lib/context/context_root.dart

Issue 2842013003: Add support for watch events and error notifications (Closed)
Patch Set: fix comment Created 3 years, 8 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
Index: pkg/analyzer/lib/context/context_root.dart
diff --git a/pkg/analyzer/lib/context/context_root.dart b/pkg/analyzer/lib/context/context_root.dart
index f871ab1c0a8993bd93aa8895d26917d86bddc601..cfc47ff8f99c2c0ebbadbf3ed75c5cbb49422994 100644
--- a/pkg/analyzer/lib/context/context_root.dart
+++ b/pkg/analyzer/lib/context/context_root.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/generated/utilities_general.dart';
+import 'package:path/path.dart' as path;
/**
* Information about the root directory associated with an analysis context.
@@ -45,6 +46,24 @@ class ContextRoot {
}
/**
+ * Return `true` if the file with the given [filePath] is contained within
+ * this context root. A file contained in a context root if it is within the
+ * context [root] neither explicitly excluded or within one of the excluded
+ * directories.
+ */
+ bool containsFile(String filePath) {
+ if (!path.isWithin(root, filePath)) {
+ return false;
+ }
+ for (String excluded in exclude) {
+ if (filePath == excluded || path.isWithin(excluded, filePath)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
* Compare the lists [listA] and [listB], using [itemEqual] to compare
* list elements.
*/

Powered by Google App Engine
This is Rietveld 408576698