Skip to content

Commit

Permalink
[mini_types] Decouple NamedFunctionParameter from NamedType.
Browse files Browse the repository at this point in the history
Previously, NamedFunctionParameter was derived from NamedType. This
avoided a tiny amount of code duplication, but the benefit was really
tiny. Decoupling the two classes simplifies the implementation of a
follow-up CL that I have in progress, which will allow the mini_types
framework to represent function types.

Change-Id: I29bff36ab76bbf344cf7204f2503b006a88a4cf8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395422
Reviewed-by: Kallen Tu <[email protected]>
Commit-Queue: Paul Berry <[email protected]>
  • Loading branch information
stereotype441 authored and Commit Queue committed Nov 14, 2024
1 parent ca9c123 commit 2d367c8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/_fe_analyzer_shared/test/mini_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,19 @@ class InvalidType extends _SpecialSimpleType
}

/// A named parameter of a function type.
class NamedFunctionParameter extends NamedType
class NamedFunctionParameter
implements SharedNamedFunctionParameterStructure<Type> {
@override
final String name;

@override
final Type type;

@override
final bool isRequired;

NamedFunctionParameter(
{required this.isRequired, required super.name, required super.type});
{required this.isRequired, required this.name, required this.type});

@override
String toString() => [if (isRequired) 'required', type, name].join(' ');
Expand Down

0 comments on commit 2d367c8

Please sign in to comment.