| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Regression test for issue 23058. |
| 6 |
| 5 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 6 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
| 7 | 9 |
| 8 range(start, end) async* { | 10 class A { |
| 9 for (int i = start; i < end; i++) { | 11 var x = new B(); |
| 10 yield i; | 12 |
| 13 foo() async { |
| 14 return x.foo == 2 ? 42 : x.foo; |
| 11 } | 15 } |
| 12 } | 16 } |
| 13 | 17 |
| 14 concat(a, b) async* { | 18 class B { |
| 15 yield* a; | 19 var x = 0; |
| 16 yield* b; | |
| 17 } | |
| 18 | 20 |
| 19 test() async { | 21 get foo { |
| 20 Expect.listEquals([1, 2, 3, 11, 12, 13], | 22 if (x == -1) { |
| 21 await concat(range(1, 4), range(11, 14)).toList()); | 23 return 0; |
| 24 } else { |
| 25 return x++; |
| 26 } |
| 27 } |
| 22 } | 28 } |
| 23 | 29 |
| 24 main() { | 30 main() { |
| 25 asyncStart(); | 31 asyncStart(); |
| 26 test().then((_) { | 32 new A().foo().then((result) { |
| 33 Expect.equals(1, result); |
| 27 asyncEnd(); | 34 asyncEnd(); |
| 28 }); | 35 }); |
| 29 } | 36 } |
| OLD | NEW |