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

Unified Diff: third_party/pkg/route_hierarchical/lib/src/async_utils.dart

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 12 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: third_party/pkg/route_hierarchical/lib/src/async_utils.dart
diff --git a/third_party/pkg/route_hierarchical/lib/src/async_utils.dart b/third_party/pkg/route_hierarchical/lib/src/async_utils.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c12365fe9888edfca772fd2ce9000e13564f2891
--- /dev/null
+++ b/third_party/pkg/route_hierarchical/lib/src/async_utils.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library route.async_utils;
+
+import 'dart:async';
+
+Future doWhile(Iterable iterable, Future<bool> action(i)) =>
+ _doWhile(iterable.iterator, action);
+
+Future _doWhile(Iterator iterator, Future<bool> action(i)) =>
+ (iterator.moveNext())
+ ? action(iterator.current).then((bool result) =>
+ (result)
+ ? _doWhile(iterator, action)
+ : new Future.value(false))
+ : new Future.value(false);

Powered by Google App Engine
This is Rietveld 408576698