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

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

Issue 1007233002: Add readAsStringSync() to File. (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
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 e5def6a28da74985aaef2e78314388300bf2a4b3..4a365ee733633a213f2694bd17586ab5a10cfae2 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -206,6 +206,11 @@ class _MemoryDummyLink extends _MemoryResource implements File {
bool isOrContains(String path) {
return path == this.path;
}
+
+ @override
+ String readAsStringSync() {
+ throw new FileSystemException(path, 'File could not be read');
+ }
}
/**
@@ -221,7 +226,7 @@ class _MemoryFile extends _MemoryResource implements File {
int get modificationStamp {
int stamp = _provider._pathToTimestamp[path];
if (stamp == null) {
- throw new FileSystemException(path, 'File does not exist.');
+ throw new FileSystemException(path, 'File "$path" does not exist.');
}
return stamp;
}
@@ -229,7 +234,7 @@ class _MemoryFile extends _MemoryResource implements File {
String get _content {
String content = _provider._pathToContent[path];
if (content == null) {
- throw new FileSystemException(path, "File does not exist");
+ throw new FileSystemException(path, 'File "$path" does not exist.');
}
return content;
}
@@ -246,6 +251,15 @@ class _MemoryFile extends _MemoryResource implements File {
bool isOrContains(String path) {
return path == this.path;
}
+
+ @override
+ String readAsStringSync() {
+ String content = _provider._pathToContent[path];
+ if (content == null) {
+ throw new FileSystemException(path, 'File "$path" does not exist.');
+ }
+ return content;
+ }
}
/**
« no previous file with comments | « pkg/analyzer/lib/file_system/file_system.dart ('k') | pkg/analyzer/lib/file_system/physical_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698