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

Unified Diff: pkg/http/lib/src/utils.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « pkg/http/lib/src/response.dart ('k') | pkg/http/lib/testing.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/utils.dart
diff --git a/pkg/http/lib/src/utils.dart b/pkg/http/lib/src/utils.dart
index 1a9aff347e16a94d3542de2a4e593235921b2103..0a82dfd1225b5ef17b632defc5557ddc1a68cac0 100644
--- a/pkg/http/lib/src/utils.dart
+++ b/pkg/http/lib/src/utils.dart
@@ -4,9 +4,9 @@
library utils;
+import 'dart:async';
import 'dart:crypto';
import 'dart:io';
-import 'dart:isolate';
import 'dart:scalarlist';
import 'dart:uri';
import 'dart:utf';
@@ -36,7 +36,7 @@ String mapToQuery(Map<String, String> map) {
var pairs = <List<String>>[];
map.forEach((key, value) =>
pairs.add([encodeUriComponent(key), encodeUriComponent(value)]));
- return Strings.join(pairs.map((pair) => "${pair[0]}=${pair[1]}"), "&");
+ return Strings.join(pairs.mappedBy((pair) => "${pair[0]}=${pair[1]}"), "&");
}
/// Adds all key/value pairs from [source] to [destination], overwriting any
@@ -140,7 +140,7 @@ Future<List<int>> consumeInputStream(InputStream stream) {
var buffer = <int>[];
stream.onClosed = () => completer.complete(buffer);
stream.onData = () => buffer.addAll(stream.read());
- stream.onError = completer.completeException;
+ stream.onError = completer.completeError;
return completer.future;
}
@@ -183,10 +183,10 @@ Future get async {
/// The return values of all [Future]s are discarded. Any errors will cause the
/// iteration to stop and will be piped through the return value.
Future forEachFuture(Iterable input, Future fn(element)) {
- var iterator = input.iterator();
+ var iterator = input.iterator;
Future nextElement(_) {
- if (!iterator.hasNext) return new Future.immediate(null);
- return fn(iterator.next()).chain(nextElement);
+ if (!iterator.moveNext()) return new Future.immediate(null);
+ return fn(iterator.current).then(nextElement);
}
return nextElement(null);
}
« no previous file with comments | « pkg/http/lib/src/response.dart ('k') | pkg/http/lib/testing.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698