OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 class C { | 5 class C { |
6 var t; | 6 var t; |
7 C.foo(f) : t = (() => f()) { | 7 C.foo(f, x) : t = (() => f(x)) { |
8 print(1); | 8 x = 1; |
| 9 print(x); |
9 } | 10 } |
10 } | 11 } |
11 | 12 |
12 main() { | 13 main() { |
13 print(0); | 14 print(0); |
14 var c = new C.foo(() => print('hest')); | 15 var c = new C.foo((x) => print('hest${x}'), 0); |
15 print(2); | 16 print(2); |
16 c.t(); | 17 c.t(); |
17 print(3); | 18 print(3); |
18 } | 19 } |
OLD | NEW |