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

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

Issue 989393002: Wrap dart:io exception in getChildren(), implement for the memory FS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/analyzer/lib/file_system/physical_file_system.dart » ('j') | 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 da68f08c0ee42136a537e21a64155d4083a1e921..e5def6a28da74985aaef2e78314388300bf2a4b3 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -110,17 +110,6 @@ class MemoryResourceProvider implements ResourceProvider {
return file;
}
- File updateFile(String path, String content, [int stamp]) {
- path = posix.normalize(path);
- newFolder(posix.dirname(path));
- _MemoryFile file = new _MemoryFile(this, path);
- _pathToResource[path] = file;
- _pathToContent[path] = content;
- _pathToTimestamp[path] = stamp != null ? stamp : nextStamp++;
- _notifyWatchers(path, ChangeType.MODIFY);
- return file;
- }
-
Folder newFolder(String path) {
path = posix.normalize(path);
if (!path.startsWith('/')) {
@@ -145,6 +134,17 @@ class MemoryResourceProvider implements ResourceProvider {
}
}
+ File updateFile(String path, String content, [int stamp]) {
+ path = posix.normalize(path);
+ newFolder(posix.dirname(path));
+ _MemoryFile file = new _MemoryFile(this, path);
+ _pathToResource[path] = file;
+ _pathToContent[path] = content;
+ _pathToTimestamp[path] = stamp != null ? stamp : nextStamp++;
+ _notifyWatchers(path, ChangeType.MODIFY);
+ return file;
+ }
+
void _checkFileAtPath(String path) {
_MemoryResource resource = _pathToResource[path];
if (resource is! _MemoryFile) {
@@ -398,6 +398,9 @@ class _MemoryFolder extends _MemoryResource implements Folder {
@override
List<Resource> getChildren() {
+ if (!exists) {
+ throw new FileSystemException(path, 'Folder does not exist.');
+ }
List<Resource> children = <Resource>[];
_provider._pathToResource.forEach((resourcePath, resource) {
if (posix.dirname(resourcePath) == path) {
« no previous file with comments | « no previous file | pkg/analyzer/lib/file_system/physical_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698