| 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 // Test that a parameter used in two different closures defined in a |
| 6 // constructor initializer, is properly boxed. |
| 7 |
| 5 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 6 | 9 |
| 7 class A { | 10 class A { |
| 8 var f; | 11 var f; |
| 9 var g; | 12 var g; |
| 10 A(a) : f = (() => 42 + a), g = (() => ++a) { | 13 A(a) : f = (() => 42 + a), g = (() => ++a) { |
| 11 a = 4; | 14 a = 4; |
| 12 } | 15 } |
| 13 } | 16 } |
| 14 | 17 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 35 a = new C(0); | 38 a = new C(0); |
| 36 Expect.equals(46, a.f()); | 39 Expect.equals(46, a.f()); |
| 37 Expect.equals(5, a.g()); | 40 Expect.equals(5, a.g()); |
| 38 Expect.equals(47, a.f()); | 41 Expect.equals(47, a.f()); |
| 39 Expect.equals(1, a.h()); | 42 Expect.equals(1, a.h()); |
| 40 Expect.equals(2, a.h()); | 43 Expect.equals(2, a.h()); |
| 41 Expect.equals(47, a.f()); | 44 Expect.equals(47, a.f()); |
| 42 Expect.equals(6, a.g()); | 45 Expect.equals(6, a.g()); |
| 43 Expect.equals(48, a.f()); | 46 Expect.equals(48, a.f()); |
| 44 } | 47 } |
| OLD | NEW |