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

Unified Diff: tests/language/await_future_test.dart

Issue 520223002: Fix scoping async functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase + added comment Created 6 years, 3 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 | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/await_future_test.dart
diff --git a/tests/language/await_future_test.dart b/tests/language/await_future_test.dart
index 9811f37f171181069532add2933a3c9748fa6ce6..ff1ab7a902af082ec4b070d3e7e21c0eec7cba56 100644
--- a/tests/language/await_future_test.dart
+++ b/tests/language/await_future_test.dart
@@ -48,6 +48,28 @@ quazz() async {
}
}
+nesting() async {
+ try {
+ try {
+ var x = 1;
+ var y = () async {
+ try {
+ var z = (await bar(3)) + x;
+ throw z;
+ } catch (e1) {
+ return e1;
+ }
+ };
+ var a = await y();
+ throw a;
+ } catch (e2) {
+ throw e2 + 1;
+ }
+ } catch (e3) {
+ return e3;
+ }
+}
+
main() async {
var result;
for (int i = 0; i < 10; i++) {
@@ -57,5 +79,7 @@ main() async {
Expect.equals(result, 17);
result = await quazz();
Expect.equals(result, 2);
+ result = await nesting();
+ Expect.equals(result, 5);
}
}
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698