Chromium Code Reviews| 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 b038f45eb92ab1863a5b45e62e64dd41ea49d581..9fc1262c88314932839948307787baea7e0a48df 100644 |
| --- a/pkg/analyzer/lib/file_system/memory_file_system.dart |
| +++ b/pkg/analyzer/lib/file_system/memory_file_system.dart |
| @@ -16,22 +16,6 @@ import 'file_system.dart'; |
| /** |
| - * Exception thrown when a memory [Resource] file operation fails. |
| - */ |
| -class MemoryResourceException { |
| - final path; |
| - final message; |
| - |
| - MemoryResourceException(this.path, this.message); |
| - |
| - @override |
| - String toString() { |
| - return "MemoryResourceException(path=$path; message=$message)"; |
| - } |
| -} |
| - |
| - |
| -/** |
| * An in-memory implementation of [ResourceProvider]. |
| * Use `/` as a path separator. |
| */ |
| @@ -159,15 +143,21 @@ class _MemoryDummyLink extends _MemoryResource implements File { |
| @override |
| bool get exists => false; |
| - String get _content { |
| - throw new MemoryResourceException(path, "File '$path' could not be read"); |
| + int get modificationStamp { |
| + int stamp = _provider._pathToTimestamp[path]; |
| + if (stamp == null) { |
| + return -1; |
|
Brian Wilkerson
2015/02/23 17:29:53
Should this throw an exception? Is there an OS tha
|
| + } |
| + return stamp; |
| } |
| - int get _timestamp => _provider._pathToTimestamp[path]; |
| + String get _content { |
| + throw new FileSystemException(path, 'File could not be read'); |
| + } |
| @override |
| Source createSource([Uri uri]) { |
| - throw new MemoryResourceException(path, "File '$path' could not be read"); |
| + throw new FileSystemException(path, 'File could not be read'); |
| } |
| @override |
| @@ -184,16 +174,22 @@ class _MemoryFile extends _MemoryResource implements File { |
| _MemoryFile(MemoryResourceProvider provider, String path) |
| : super(provider, path); |
| + int get modificationStamp { |
| + int stamp = _provider._pathToTimestamp[path]; |
| + if (stamp == null) { |
| + throw new FileSystemException(path, 'File does not exist.'); |
| + } |
| + return stamp; |
| + } |
| + |
| String get _content { |
| String content = _provider._pathToContent[path]; |
| if (content == null) { |
| - throw new MemoryResourceException(path, "File '$path' does not exist"); |
| + throw new FileSystemException(path, "File does not exist"); |
| } |
| return content; |
| } |
| - int get _timestamp => _provider._pathToTimestamp[path]; |
| - |
| @override |
| Source createSource([Uri uri]) { |
| if (uri == null) { |
| @@ -239,7 +235,13 @@ class _MemoryFileSource extends Source { |
| bool get isInSystemLibrary => uriKind == UriKind.DART_URI; |
| @override |
| - int get modificationStamp => _file._timestamp; |
| + int get modificationStamp { |
| + try { |
| + return _file.modificationStamp; |
| + } on FileSystemException catch (e) { |
|
Brian Wilkerson
2015/02/23 17:29:53
Why is this exception is being caught?
|
| + return -1; |
| + } |
| + } |
| @override |
| String get shortName => _file.shortName; |