| 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 | 4 |
| 5 import "package:expect/expect.dart"; |
| 6 |
| 5 closure0() { | 7 closure0() { |
| 6 var input = [1, 2, 3]; | 8 var input = [1, 2, 3]; |
| 7 var fs = []; | 9 var fs = []; |
| 8 for (var x in input) { | 10 for (var x in input) { |
| 9 fs.add(fun() { return x; }); | 11 fs.add(fun() { return x; }); |
| 10 } | 12 } |
| 11 Expect.equals(3, fs.length); | 13 Expect.equals(3, fs.length); |
| 12 Expect.equals(1, fs[0]()); | 14 Expect.equals(1, fs[0]()); |
| 13 Expect.equals(2, fs[1]()); | 15 Expect.equals(2, fs[1]()); |
| 14 Expect.equals(3, fs[2]()); | 16 Expect.equals(3, fs[2]()); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 86 } |
| 85 | 87 |
| 86 main() { | 88 main() { |
| 87 closure0(); | 89 closure0(); |
| 88 closure1(); | 90 closure1(); |
| 89 closure2(); | 91 closure2(); |
| 90 closure3(); | 92 closure3(); |
| 91 closure4(); | 93 closure4(); |
| 92 closure5(); | 94 closure5(); |
| 93 } | 95 } |
| OLD | NEW |