OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // Dart test for capturing. | 4 // Dart test for capturing. |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 // Regression test for issue 5991015. | 8 // Regression test for issue 5991015. |
9 | 9 |
10 class V { | 10 class V { |
| 11 notCalled(Function x) { |
| 12 return x(); |
| 13 } |
11 | 14 |
12 notCalled(Function x) { return x(); } | 15 foofoo(x) { |
13 | 16 return x; |
14 foofoo(x) { return x; } | 17 } |
15 | 18 |
16 hoop(input, n) { | 19 hoop(input, n) { |
17 while (n-- > 0) { | 20 while (n-- > 0) { |
18 Expect.equals(5, input); | 21 Expect.equals(5, input); |
19 continue; // This continue statement must properly unchain the context. | 22 continue; // This continue statement must properly unchain the context. |
20 switch (input) { | 23 switch (input) { |
21 case 3: | 24 case 3: |
22 var values = foofoo; | 25 var values = foofoo; |
23 notCalled(() => values(input)); | 26 notCalled(() => values(input)); |
24 } | 27 } |
25 } | 28 } |
26 } | 29 } |
27 } | 30 } |
28 | 31 |
29 main() { | 32 main() { |
30 new V().hoop(5, 3); | 33 new V().hoop(5, 3); |
31 } | 34 } |
OLD | NEW |