Skip to content

Commit 2110e90

Browse files
committed
Rename 'declaring-constructors' to 'primary-constructors' experiment flag.
Changed the flag to `primary-constructors` to align with the rest of the feature's public naming. Renamed tests and existing usages of the flag. Bug: #61526 Change-Id: Id649447a50917ba5bcddb49661555889dc81ba14 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464761 Reviewed-by: Johnni Winther <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Reviewed-by: Erik Ernst <[email protected]> Reviewed-by: Michael Thomsen <[email protected]>
1 parent 28611ff commit 2110e90

File tree

280 files changed

+1932
-1937
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+1932
-1937
lines changed

pkg/_fe_analyzer_shared/lib/src/experiments/flags.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,6 @@ enum ExperimentalFlag {
7474
experimentReleasedVersion: defaultLanguageVersion,
7575
),
7676

77-
declaringConstructors(
78-
name: 'declaring-constructors',
79-
isEnabledByDefault: false,
80-
isExpired: false,
81-
experimentEnabledVersion: defaultLanguageVersion,
82-
experimentReleasedVersion: defaultLanguageVersion,
83-
),
84-
8577
digitSeparators(
8678
name: 'digit-separators',
8779
isEnabledByDefault: true,
@@ -242,6 +234,14 @@ enum ExperimentalFlag {
242234
experimentReleasedVersion: const Version(3, 0),
243235
),
244236

237+
primaryConstructors(
238+
name: 'primary-constructors',
239+
isEnabledByDefault: false,
240+
isExpired: false,
241+
experimentEnabledVersion: defaultLanguageVersion,
242+
experimentReleasedVersion: defaultLanguageVersion,
243+
),
244+
245245
privateNamedParameters(
246246
name: 'private-named-parameters',
247247
isEnabledByDefault: false,

pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ class Parser {
325325
/// `true` if the 'enhanced-parts' feature is enabled.
326326
final bool _isEnhancedPartsFeatureEnabled;
327327

328-
/// `true` if the 'declaring-constructors' feature is enabled.
329-
final bool _isDeclaringConstructorsFeatureEnabled;
328+
/// `true` if the 'primary-constructors' feature is enabled.
329+
final bool _isPrimaryConstructorsFeatureEnabled;
330330

331331
/// `true` if the 'private-named-parameters' feature is enabled.
332332
final bool _isPrivateNamedParametersEnabled;
@@ -354,8 +354,8 @@ class Parser {
354354
),
355355
_isEnhancedPartsFeatureEnabled = experimentalFeatures
356356
.isExperimentEnabled(ExperimentalFlag.enhancedParts),
357-
_isDeclaringConstructorsFeatureEnabled = experimentalFeatures
358-
.isExperimentEnabled(ExperimentalFlag.declaringConstructors),
357+
_isPrimaryConstructorsFeatureEnabled = experimentalFeatures
358+
.isExperimentEnabled(ExperimentalFlag.primaryConstructors),
359359
_isPrivateNamedParametersEnabled = experimentalFeatures
360360
.isExperimentEnabled(ExperimentalFlag.privateNamedParameters);
361361

@@ -2215,9 +2215,9 @@ class Parser {
22152215
codes.codeFunctionTypedParameterVar,
22162216
);
22172217
} else {
2218-
if (!_isDeclaringConstructorsFeatureEnabled) {
2218+
if (!_isPrimaryConstructorsFeatureEnabled) {
22192219
reportExperimentNotEnabled(
2220-
ExperimentalFlag.declaringConstructors,
2220+
ExperimentalFlag.primaryConstructors,
22212221
varFinalOrConst,
22222222
varFinalOrConst,
22232223
);
@@ -2237,9 +2237,9 @@ class Parser {
22372237
codes.codeFunctionTypedParameterVar,
22382238
);
22392239
} else {
2240-
if (!_isDeclaringConstructorsFeatureEnabled) {
2240+
if (!_isPrimaryConstructorsFeatureEnabled) {
22412241
reportExperimentNotEnabled(
2242-
ExperimentalFlag.declaringConstructors,
2242+
ExperimentalFlag.primaryConstructors,
22432243
varFinalOrConst,
22442244
varFinalOrConst,
22452245
);
@@ -2258,9 +2258,9 @@ class Parser {
22582258
if (memberKind != MemberKind.PrimaryConstructor) {
22592259
reportRecoverableError(varFinalOrConst, codes.codeTypeAfterVar);
22602260
} else {
2261-
if (!_isDeclaringConstructorsFeatureEnabled) {
2261+
if (!_isPrimaryConstructorsFeatureEnabled) {
22622262
reportExperimentNotEnabled(
2263-
ExperimentalFlag.declaringConstructors,
2263+
ExperimentalFlag.primaryConstructors,
22642264
varOrFinal,
22652265
varOrFinal,
22662266
);
@@ -3072,9 +3072,9 @@ class Parser {
30723072
token = parseClassHeaderOpt(token, beginToken, classKeyword);
30733073
if (token.next!.isA(TokenType.SEMICOLON)) {
30743074
Token semicolonToken = token = token.next!;
3075-
if (!_isDeclaringConstructorsFeatureEnabled) {
3075+
if (!_isPrimaryConstructorsFeatureEnabled) {
30763076
reportExperimentNotEnabled(
3077-
ExperimentalFlag.declaringConstructors,
3077+
ExperimentalFlag.primaryConstructors,
30783078
semicolonToken,
30793079
semicolonToken,
30803080
);
@@ -3787,9 +3787,9 @@ class Parser {
37873787
token = parseClassOrMixinOrEnumImplementsOpt(token);
37883788
if (token.next!.isA(TokenType.SEMICOLON)) {
37893789
Token semicolonToken = token = token.next!;
3790-
if (!_isDeclaringConstructorsFeatureEnabled) {
3790+
if (!_isPrimaryConstructorsFeatureEnabled) {
37913791
reportExperimentNotEnabled(
3792-
ExperimentalFlag.declaringConstructors,
3792+
ExperimentalFlag.primaryConstructors,
37933793
semicolonToken,
37943794
semicolonToken,
37953795
);
@@ -5209,9 +5209,9 @@ class Parser {
52095209
bool nameIsRecovered = false;
52105210
if (next.isA(Keyword.NEW)) {
52115211
newToken = next;
5212-
if (!_isDeclaringConstructorsFeatureEnabled) {
5212+
if (!_isPrimaryConstructorsFeatureEnabled) {
52135213
reportExperimentNotEnabled(
5214-
ExperimentalFlag.declaringConstructors,
5214+
ExperimentalFlag.primaryConstructors,
52155215
newToken,
52165216
newToken,
52175217
);
@@ -5253,7 +5253,7 @@ class Parser {
52535253
);
52545254
listener.endMember();
52555255
return token;
5256-
} else if (_isDeclaringConstructorsFeatureEnabled &&
5256+
} else if (_isPrimaryConstructorsFeatureEnabled &&
52575257
next2.isA(TokenType.OPEN_PAREN)) {
52585258
if (typeInfo == noType &&
52595259
covariantToken == null &&
@@ -5350,9 +5350,9 @@ class Parser {
53505350
if (next2.isA(TokenType.COLON) ||
53515351
next2.isA(TokenType.SEMICOLON) ||
53525352
next2.isA(TokenType.OPEN_CURLY_BRACKET)) {
5353-
if (!_isDeclaringConstructorsFeatureEnabled) {
5353+
if (!_isPrimaryConstructorsFeatureEnabled) {
53545354
reportExperimentNotEnabled(
5355-
ExperimentalFlag.declaringConstructors,
5355+
ExperimentalFlag.primaryConstructors,
53565356
next,
53575357
next,
53585358
);

pkg/_fe_analyzer_shared/messages.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,7 +2446,7 @@ NewConstructorQualifiedName:
24462446
correctionMessage: "Try removing the class name prefix from the qualified name or removing the 'new' keyword."
24472447
analyzerCode: ParserErrorCode.NEW_CONSTRUCTOR_QUALIFIED_NAME
24482448
hasPublishedDocs: false
2449-
experiments: declaring-constructors
2449+
experiments: primary-constructors
24502450
script: |
24512451
class C {
24522452
new C.named();
@@ -2459,7 +2459,7 @@ NewConstructorNewName:
24592459
correctionMessage: "Try removing the second 'new' or changing it to a different name."
24602460
analyzerCode: ParserErrorCode.NEW_CONSTRUCTOR_NEW_NAME
24612461
hasPublishedDocs: false
2462-
experiments: declaring-constructors
2462+
experiments: primary-constructors
24632463
script: |
24642464
class C {
24652465
new new();
@@ -2472,7 +2472,7 @@ FactoryConstructorNewName:
24722472
correctionMessage: "Try removing the 'new' keyword or changing it to a different name."
24732473
analyzerCode: ParserErrorCode.FACTORY_CONSTRUCTOR_NEW_NAME
24742474
hasPublishedDocs: false
2475-
experiments: declaring-constructors
2475+
experiments: primary-constructors
24762476
script: |
24772477
class C {
24782478
factory new() => throw '';

pkg/analysis_server/test/src/services/correction/fix/make_final_test.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,7 @@ class PreferFinalParametersBulkTest extends BulkFixProcessorTest {
467467
@override
468468
List<String> get experiments => super.experiments
469469
.where(
470-
(experiment) =>
471-
experiment != Feature.declaring_constructors.enableString,
470+
(experiment) => experiment != Feature.primary_constructors.enableString,
472471
)
473472
.toList();
474473

@@ -496,8 +495,7 @@ class PreferFinalParametersTest extends FixProcessorLintTest {
496495
@override
497496
List<String> get experiments => super.experiments
498497
.where(
499-
(experiment) =>
500-
experiment != Feature.declaring_constructors.enableString,
498+
(experiment) => experiment != Feature.primary_constructors.enableString,
501499
)
502500
.toList();
503501

pkg/analyzer/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ package:analyzer/dart/analysis/features.dart:
400400
constant_update_2018 (static getter: ExperimentalFeature)
401401
constructor_tearoffs (static getter: ExperimentalFeature)
402402
control_flow_collections (static getter: ExperimentalFeature)
403-
declaring_constructors (static getter: ExperimentalFeature)
404403
digit_separators (static getter: ExperimentalFeature)
405404
dot_shorthands (static getter: ExperimentalFeature)
406405
enhanced_enums (static getter: ExperimentalFeature)
@@ -420,6 +419,7 @@ package:analyzer/dart/analysis/features.dart:
420419
nonfunction_type_aliases (static getter: ExperimentalFeature)
421420
null_aware_elements (static getter: ExperimentalFeature)
422421
patterns (static getter: ExperimentalFeature)
422+
primary_constructors (static getter: ExperimentalFeature)
423423
private_named_parameters (static getter: ExperimentalFeature)
424424
records (static getter: ExperimentalFeature)
425425
sealed_class (static getter: ExperimentalFeature)

pkg/analyzer/lib/dart/analysis/features.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ abstract class Feature {
1818
/// Feature information for class modifiers.
1919
static final class_modifiers = ExperimentalFeatures.class_modifiers;
2020

21-
/// Feature information for declaring constructors.
22-
static final declaring_constructors =
23-
ExperimentalFeatures.declaring_constructors;
24-
2521
/// Feature information for number literal digit separators.
2622
static final digit_separators = ExperimentalFeatures.digit_separators;
2723

@@ -84,6 +80,9 @@ abstract class Feature {
8480
/// Feature information for patterns.
8581
static final patterns = ExperimentalFeatures.patterns;
8682

83+
/// Feature information for primary constructors.
84+
static final primary_constructors = ExperimentalFeatures.primary_constructors;
85+
8786
/// Feature information for private named parameters.
8887
static final private_named_parameters =
8988
ExperimentalFeatures.private_named_parameters;

pkg/analyzer/lib/src/dart/analysis/driver.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ testFineAfterLibraryAnalyzerHook;
108108
// TODO(scheglov): Clean up the list of implicitly analyzed files.
109109
class AnalysisDriver {
110110
/// The version of data format, should be incremented on every format change.
111-
static const int DATA_VERSION = 587;
111+
static const int DATA_VERSION = 588;
112112

113113
/// The number of exception contexts allowed to write. Once this field is
114114
/// zero, we stop writing any new exception contexts in this process.

0 commit comments

Comments
 (0)