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

Unified Diff: sdk/lib/io/file_impl.dart

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
Index: sdk/lib/io/file_impl.dart
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index 65f7adfb75586a616a00fd4efb56aed66726a9ea..95dfc80fb4672a5a31dad07125a29597ff8323e0 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -58,7 +58,7 @@ class _FileStream extends Stream<List<int>> {
_openedFile = null;
return closeFuture;
} else {
- return new Future.immediate(null);
+ return new Future.value();
}
}
@@ -106,7 +106,7 @@ class _FileStream extends Stream<List<int>> {
if (_path != null) {
openFuture = new File(_path).open(mode: FileMode.READ);
} else {
- openFuture = new Future.immediate(_File._openStdioSync(0));
+ openFuture = new Future.value(_File._openStdioSync(0));
}
openFuture
.then((RandomAccessFile opened) {
@@ -158,7 +158,7 @@ class _FileStreamConsumer extends StreamConsumer<List<int>> {
_FileStreamConsumer.fromStdio(int fd) {
assert(1 <= fd && fd <= 2);
- _openFuture = new Future.immediate(_File._openStdioSync(fd));
+ _openFuture = new Future.value(_File._openStdioSync(fd));
}
Future<File> consume(Stream<List<int>> stream) {
@@ -561,7 +561,7 @@ class _File extends _FileBase implements File {
sink.close();
return sink.done.then((_) => this);;
} catch (e) {
- return new Future.immediateError(e);
+ return new Future.error(e);
}
}

Powered by Google App Engine
This is Rietveld 408576698