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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // VMOptions=--enable_async --optimization-counter-threshold=5 5 // VMOptions=--enable_async --optimization-counter-threshold=5
6 6
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 10
(...skipping 30 matching lines...) Expand all
41 throw x; 41 throw x;
42 } catch (e1) { 42 } catch (e1) {
43 var y = await baz(e1 + 1); 43 var y = await baz(e1 + 1);
44 throw y; 44 throw y;
45 } 45 }
46 } catch (e2) { 46 } catch (e2) {
47 return e2; 47 return e2;
48 } 48 }
49 } 49 }
50 50
51 nesting() async {
52 try {
53 try {
54 var x = 1;
55 var y = () async {
56 try {
57 var z = (await bar(3)) + x;
58 throw z;
59 } catch (e1) {
60 return e1;
61 }
62 };
63 var a = await y();
64 throw a;
65 } catch (e2) {
66 throw e2 + 1;
67 }
68 } catch (e3) {
69 return e3;
70 }
71 }
72
51 main() async { 73 main() async {
52 var result; 74 var result;
53 for (int i = 0; i < 10; i++) { 75 for (int i = 0; i < 10; i++) {
54 result = await foo(); 76 result = await foo();
55 Expect.equals(result, 30); 77 Expect.equals(result, 30);
56 result = await quaz(17); 78 result = await quaz(17);
57 Expect.equals(result, 17); 79 Expect.equals(result, 17);
58 result = await quazz(); 80 result = await quazz();
59 Expect.equals(result, 2); 81 Expect.equals(result, 2);
82 result = await nesting();
83 Expect.equals(result, 5);
60 } 84 }
61 } 85 }
OLDNEW
« runtime/vm/parser.cc ('K') | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698