Skip to content

Commit 6317779

Browse files
stereotype441commit-bot@chromium.org
authored andcommitted
Simplify TestTypeProvider constructor.
The only optional parameter that was actually used was nullabilitySuffix, so eliminate the others, and make it a named parameter for easier future expansion. Change-Id: Iee05e955a1c996b4e1dd9bbec3db7fd1588ebe04 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124001 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
1 parent 7e8e660 commit 6317779

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

pkg/analyzer/lib/src/generated/testing/test_type_provider.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ import 'package:analyzer/src/test_utilities/mock_sdk_elements.dart';
1515
* for the core library.
1616
*/
1717
class TestTypeProvider extends TypeProviderImpl {
18-
factory TestTypeProvider([
19-
AnalysisContext context,
20-
Object analysisDriver,
18+
factory TestTypeProvider({
2119
NullabilitySuffix nullabilitySuffix = NullabilitySuffix.star,
22-
]) {
23-
context ??= _MockAnalysisContext();
20+
}) {
21+
var context = _MockAnalysisContext();
2422
var sdkElements = MockSdkElements(context, nullabilitySuffix);
2523
return TestTypeProvider._(
2624
nullabilitySuffix,

pkg/analyzer/test/src/dart/element/type_algebra_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,9 @@ class _Base with ElementsTypesMixin {
387387
final bool useNnbd;
388388

389389
_Base({this.useNnbd = false})
390-
: typeProvider = TestTypeProvider(null, null,
391-
useNnbd ? NullabilitySuffix.none : NullabilitySuffix.question);
390+
: typeProvider = TestTypeProvider(
391+
nullabilitySuffix:
392+
useNnbd ? NullabilitySuffix.none : NullabilitySuffix.question);
392393

393394
InterfaceType get boolType => typeProvider.boolType;
394395

0 commit comments

Comments
 (0)