OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // The purpose of this test is to detect that closures in [LocalInitializer]s |
| 6 // are properly converted. This test assumes that |
| 7 // [ArgumentExtractionForRedirecting] transformer was run before closure |
| 8 // conversion. It should introduce one [LocalInitializer] for each argument |
| 9 // passed to the redirecting constructor. If such argument contains a closure, |
| 10 // it would appear in a [LocalInitializer]. |
| 11 |
| 12 class X {} |
| 13 |
| 14 class A { |
| 15 X foo; |
| 16 A.named(X foo) {} |
| 17 A(X foo) : this.named((() => foo)()); |
| 18 } |
| 19 |
| 20 main() { |
| 21 A a = new A(new X()); |
| 22 a.foo; // To prevent dartanalyzer from marking [a] as unused. |
| 23 } |
OLD | NEW |