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

Side by Side Diff: tests/language/await_future_test.dart

Issue 511483003: Revert "Fix scope/context behavior in await transformer." (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
« no previous file with comments | « runtime/vm/symbols.h ('k') | tests/standalone/issue14236_test.dart » ('j') | 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 var result = "";
52
53 reset() {
54 result = "";
55 }
56
57 observe(x) {
58 if (result.length > 0) {
59 result += ",";
60 }
61 result += x;
62 }
63
64 newTask(x) async => observe(x);
65
66 awaitAll(tasks) async {
67 for (var task in tasks) {
68 // This actually opens up a new context level.
69 await task;
70 }
71 }
72
73 taskTest() async {
74 var tasks = [ newTask('a'), newTask('b'), newTask('c') ];
75 reset();
76 await awaitAll(tasks);
77 Expect.equals('a,b,c', result);
78 }
79
80 main() async { 51 main() async {
81 var result; 52 var result;
82 for (int i = 0; i < 10; i++) { 53 for (int i = 0; i < 10; i++) {
83 result = await foo(); 54 result = await foo();
84 Expect.equals(result, 30); 55 Expect.equals(result, 30);
85 result = await quaz(17); 56 result = await quaz(17);
86 Expect.equals(result, 17); 57 Expect.equals(result, 17);
87 result = await quazz(); 58 result = await quazz();
88 Expect.equals(result, 2); 59 Expect.equals(result, 2);
89 await taskTest();
90 } 60 }
91 } 61 }
OLDNEW
« no previous file with comments | « runtime/vm/symbols.h ('k') | tests/standalone/issue14236_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698