| Index: pkg/analyzer2dart/test/tree_shaker_test.dart
|
| diff --git a/pkg/analyzer2dart/test/tree_shaker_test.dart b/pkg/analyzer2dart/test/tree_shaker_test.dart
|
| index 938b334e3dfc6d424797e2ba99f56b61dd1d16dc..c094f09c76dc97ba8100a55791cbe040975e7f12 100644
|
| --- a/pkg/analyzer2dart/test/tree_shaker_test.dart
|
| +++ b/pkg/analyzer2dart/test/tree_shaker_test.dart
|
| @@ -179,6 +179,74 @@ main() {
|
| helper.assertNoField('B.f1');
|
| helper.assertNoField('B.f2');
|
| });
|
| +
|
| + test('Ordinary constructor with initializer list', () {
|
| + var helper = new TreeShakerTestHelper('''
|
| +class A {
|
| + A() : x = f();
|
| + var x;
|
| + foo() {}
|
| +}
|
| +f() {}
|
| +main() {
|
| + new A().foo();
|
| +}
|
| +''');
|
| + helper.assertHasMethod('A.foo');
|
| + helper.assertHasFunction('f');
|
| + });
|
| +
|
| + test('Redirecting constructor', () {
|
| + var helper = new TreeShakerTestHelper('''
|
| +class A {
|
| + A.a1() : this.a2();
|
| + A.a2();
|
| + foo() {}
|
| +}
|
| +main() {
|
| + new A.a1().foo();
|
| +}
|
| +''');
|
| + helper.assertHasMethod('A.foo');
|
| + });
|
| +
|
| + test('Factory constructor', () {
|
| + var helper = new TreeShakerTestHelper('''
|
| +class A {
|
| + factory A() {
|
| + return new B();
|
| + }
|
| + foo() {}
|
| +}
|
| +class B {
|
| + B();
|
| + foo() {}
|
| +}
|
| +main() {
|
| + new A().foo();
|
| +}
|
| +''');
|
| + helper.assertHasMethod('B.foo');
|
| + helper.assertNoMethod('A.foo');
|
| + });
|
| +
|
| + test('Redirecting factory constructor', () {
|
| + var helper = new TreeShakerTestHelper('''
|
| +class A {
|
| + factory A() = B;
|
| + foo() {}
|
| +}
|
| +class B {
|
| + B();
|
| + foo() {}
|
| +}
|
| +main() {
|
| + new A().foo();
|
| +}
|
| +''');
|
| + helper.assertHasMethod('B.foo');
|
| + helper.assertNoMethod('A.foo');
|
| + });
|
| }
|
|
|
| class TreeShakerTestHelper {
|
|
|