OLD | NEW |
---|---|
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 | |
srdjan
2014/08/20 17:50:06
"--optimization-counter-threshold=5" as well?
Michael Lippautz (Google)
2014/08/20 20:56:07
Done.
| |
6 | |
5 import 'dart:async'; | 7 import 'dart:async'; |
6 import 'async_helper_lib.dart' as async; | |
7 | 8 |
8 class A { | 9 bar(p) => new Future(() => p); |
9 async.async get async => null; | 10 |
11 foo() async { | |
12 var b; | |
13 for(int i = 0; i < 10; i++) { | |
14 b += (await bar(1)) + (await bar(2)); | |
15 } | |
16 return b; | |
10 } | 17 } |
11 | 18 |
12 async.async topLevel() => null; | |
13 | |
14 main() { | 19 main() { |
15 var a = new A(); | 20 foo().then((result) { |
16 var b = a.async; | 21 print(result); |
hausner
2014/08/20 19:47:49
Use Expect.equals to verify that the result is cor
Michael Lippautz (Google)
2014/08/20 20:56:07
Done.
| |
17 var c = topLevel(); | 22 }); |
18 } | 23 } |
OLD | NEW |