blob: b91fbda96ff43d05d7a2265164a0340d56c53e3b [file] [log] [blame]
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'driver_resolution.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ConstructorResolutionTest);
});
}
@reflectiveTest
class ConstructorResolutionTest extends DriverResolutionTest {
test_initializer_field_functionExpression_expressionBody() async {
addTestFile(r'''
class C {
final int x;
C(int a) : x = (() => a + 1)();
}
''');
await resolveTestFile();
assertElement(findNode.simple('a + 1'), findElement.parameter('a'));
}
test_initializer_field_functionExpression_blockBody() async {
addTestFile(r'''
class C {
var x;
C(int a) : x = (() {return a + 1;})();
}
''');
await resolveTestFile();
assertElement(findNode.simple('a + 1'), findElement.parameter('a'));
}
}