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

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

Issue 1922643002: Only add files that are match an analyzed files glob. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/single_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/single_context_manager.dart
diff --git a/pkg/analysis_server/lib/src/single_context_manager.dart b/pkg/analysis_server/lib/src/single_context_manager.dart
index a38d5fda2cf69b9f701665d22298860e2a8c9f18..511b24cc4dc0fdaa5d0404fe24755f2da23aa480 100644
--- a/pkg/analysis_server/lib/src/single_context_manager.dart
+++ b/pkg/analysis_server/lib/src/single_context_manager.dart
@@ -185,12 +185,14 @@ class SingleContextManager implements ContextManager {
if (_isImplicitlyExcludedResource(resource)) {
return;
}
- // TODO(scheglov) apply pathFilter
- if (_isEqualOrWithinAny(excludedPaths, resource.path)) {
+ String path = resource.path;
+ if (_isEqualOrWithinAny(excludedPaths, path)) {
return;
}
- if (resource is File && resource.exists) {
- addedFiles.add(resource);
+ if (resource is File) {
+ if (_matchesAnyAnalyzedFilesGlob(path) && resource.exists) {
+ addedFiles.add(resource);
+ }
} else if (resource is Folder) {
for (Resource child in _getChildrenSafe(resource)) {
_addFilesInResource(addedFiles, child, excludedPaths);
@@ -241,6 +243,18 @@ class SingleContextManager implements ContextManager {
}
/**
+ * Return `true` if the given [path] matches one of the [analyzedFilesGlobs].
+ */
+ bool _matchesAnyAnalyzedFilesGlob(String path) {
+ for (Glob glob in analyzedFilesGlobs) {
+ if (glob.matches(path)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Normalize all package root sources by mapping them to folders on the
* filesystem. Ignore any package root sources that aren't folders.
*/
« no previous file with comments | « no previous file | pkg/analysis_server/test/single_context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698