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

Unified Diff: pkg/analyzer/lib/file_system/memory_file_system.dart

Issue 1244613004: Implement support for watching directories containing implicitly analyzed files (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments Created 5 years, 5 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 | « pkg/analysis_server/test/src/watch_manager_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/file_system/memory_file_system.dart
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index 8ce24724a18ce4ac0476632f311c79e7d7d943eb..cfc3aa2d5d884f88cb29cf586438b66ae3602ab0 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -108,7 +108,12 @@ class MemoryResourceProvider implements ResourceProvider {
File newFile(String path, String content, [int stamp]) {
path = posix.normalize(path);
- newFolder(posix.dirname(path));
+ _MemoryResource folder = _pathToResource[posix.dirname(path)];
+ if (folder == null) {
+ newFolder(posix.dirname(path));
+ } else if (folder is! Folder) {
+ throw new ArgumentError('Cannot create file ($path) as child of file');
+ }
_MemoryFile file = new _MemoryFile(this, path);
_pathToResource[path] = file;
_pathToContent[path] = content;
@@ -131,8 +136,10 @@ class MemoryResourceProvider implements ResourceProvider {
_MemoryFolder folder = new _MemoryFolder(this, path);
_pathToResource[path] = folder;
_pathToTimestamp[path] = nextStamp++;
+ _notifyWatchers(path, ChangeType.ADD);
return folder;
} else if (resource is _MemoryFolder) {
+ _notifyWatchers(path, ChangeType.ADD);
return resource;
} else {
String message =
« no previous file with comments | « pkg/analysis_server/test/src/watch_manager_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698