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

Unified Diff: utils/pub/utils.dart

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added co19 issue number. 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
« no previous file with comments | « utils/pub/source.dart ('k') | utils/pub/validator/compiled_dartdoc.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/utils.dart
diff --git a/utils/pub/utils.dart b/utils/pub/utils.dart
index 6836fb437d1d16beb5aa57155490d32dbf62f0a0..5e80e5701c37b52df45d4ff7dcc0fc435da5dd27 100644
--- a/utils/pub/utils.dart
+++ b/utils/pub/utils.dart
@@ -249,7 +249,7 @@ Stream<String> streamToLines(Stream<String> stream) {
Future<Iterable> futureWhere(Iterable iter, test(value)) {
return Future.wait(iter.map((e) {
var result = test(e);
- if (result is! Future) result = new Future.immediate(result);
+ if (result is! Future) result = new Future.value(result);
return result.then((result) => new Pair(e, result));
}))
.then((pairs) => pairs.where((pair) => pair.last))
@@ -343,7 +343,7 @@ Future awaitObject(object) {
if (object is Iterable) {
return Future.wait(object.map(awaitObject).toList());
}
- if (object is! Map) return new Future.immediate(object);
+ if (object is! Map) return new Future.value(object);
var pairs = <Future<Pair>>[];
object.forEach((key, value) {
« no previous file with comments | « utils/pub/source.dart ('k') | utils/pub/validator/compiled_dartdoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698