Skip to content

Commit 355cade

Browse files
Add experiment flag for Value Classes
Change-Id: I94b42676ed233c3d421ac41be1c74dd90c74501e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156005 Reviewed-by: Dmitry Stefantsov <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Javier López-Contreras <[email protected]>
1 parent 4597691 commit 355cade

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

pkg/analyzer/lib/src/dart/analysis/experiments.g.dart

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const _knownFeatures = <String, ExperimentalFeature>{
2222
EnableString.set_literals: ExperimentalFeatures.set_literals,
2323
EnableString.spread_collections: ExperimentalFeatures.spread_collections,
2424
EnableString.triple_shift: ExperimentalFeatures.triple_shift,
25+
EnableString.value_class: ExperimentalFeatures.value_class,
2526
EnableString.variance: ExperimentalFeatures.variance,
2627
};
2728

@@ -34,6 +35,7 @@ List<bool> _buildExperimentalFlagsArray() => <bool>[
3435
true, // set-literals
3536
true, // spread-collections
3637
IsEnabledByDefault.triple_shift,
38+
IsEnabledByDefault.value_class,
3739
IsEnabledByDefault.variance,
3840
];
3941

@@ -64,6 +66,9 @@ class EnableString {
6466
/// String to enable the experiment "triple-shift"
6567
static const String triple_shift = 'triple-shift';
6668

69+
/// String to enable the experiment "value-class"
70+
static const String value_class = 'value-class';
71+
6772
/// String to enable the experiment "variance"
6873
static const String variance = 'variance';
6974
}
@@ -141,8 +146,17 @@ class ExperimentalFeatures {
141146
firstSupportedVersion: null,
142147
);
143148

144-
static const variance = ExperimentalFeature(
149+
static const value_class = ExperimentalFeature(
145150
index: 8,
151+
enableString: EnableString.value_class,
152+
isEnabledByDefault: IsEnabledByDefault.value_class,
153+
isExpired: IsExpired.value_class,
154+
documentation: 'Value class',
155+
firstSupportedVersion: null,
156+
);
157+
158+
static const variance = ExperimentalFeature(
159+
index: 9,
146160
enableString: EnableString.variance,
147161
isEnabledByDefault: IsEnabledByDefault.variance,
148162
isExpired: IsExpired.variance,
@@ -178,6 +192,9 @@ class IsEnabledByDefault {
178192
/// Default state of the experiment "triple-shift"
179193
static const bool triple_shift = false;
180194

195+
/// Default state of the experiment "value-class"
196+
static const bool value_class = false;
197+
181198
/// Default state of the experiment "variance"
182199
static const bool variance = false;
183200
}
@@ -210,6 +227,9 @@ class IsExpired {
210227
/// Expiration status of the experiment "triple-shift"
211228
static const bool triple_shift = false;
212229

230+
/// Expiration status of the experiment "value-class"
231+
static const bool value_class = false;
232+
213233
/// Expiration status of the experiment "variance"
214234
static const bool variance = false;
215235
}
@@ -244,6 +264,9 @@ mixin _CurrentState {
244264
/// Current state for the flag "triple-shift"
245265
bool get triple_shift => isEnabled(ExperimentalFeatures.triple_shift);
246266

267+
/// Current state for the flag "value-class"
268+
bool get value_class => isEnabled(ExperimentalFeatures.value_class);
269+
247270
/// Current state for the flag "variance"
248271
bool get variance => isEnabled(ExperimentalFeatures.variance);
249272

pkg/front_end/lib/src/api_prototype/experimental_flags_generated.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ enum ExperimentalFlag {
1919
setLiterals,
2020
spreadCollections,
2121
tripleShift,
22+
valueClass,
2223
variance,
2324
}
2425

@@ -32,6 +33,7 @@ const Version enableNonfunctionTypeAliasesVersion = const Version(2, 10);
3233
const Version enableSetLiteralsVersion = const Version(2, 2);
3334
const Version enableSpreadCollectionsVersion = const Version(2, 2);
3435
const Version enableTripleShiftVersion = const Version(2, 10);
36+
const Version enableValueClassVersion = const Version(2, 10);
3537
const Version enableVarianceVersion = const Version(2, 10);
3638

3739
ExperimentalFlag parseExperimentalFlag(String flag) {
@@ -54,6 +56,8 @@ ExperimentalFlag parseExperimentalFlag(String flag) {
5456
return ExperimentalFlag.spreadCollections;
5557
case "triple-shift":
5658
return ExperimentalFlag.tripleShift;
59+
case "value-class":
60+
return ExperimentalFlag.valueClass;
5761
case "variance":
5862
return ExperimentalFlag.variance;
5963
}
@@ -70,6 +74,7 @@ const Map<ExperimentalFlag, bool> defaultExperimentalFlags = {
7074
ExperimentalFlag.setLiterals: true,
7175
ExperimentalFlag.spreadCollections: true,
7276
ExperimentalFlag.tripleShift: false,
77+
ExperimentalFlag.valueClass: false,
7378
ExperimentalFlag.variance: false,
7479
};
7580

@@ -83,6 +88,7 @@ const Map<ExperimentalFlag, bool> expiredExperimentalFlags = {
8388
ExperimentalFlag.setLiterals: true,
8489
ExperimentalFlag.spreadCollections: true,
8590
ExperimentalFlag.tripleShift: false,
91+
ExperimentalFlag.valueClass: false,
8692
ExperimentalFlag.variance: false,
8793
};
8894

tools/experimental_features.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ features:
104104
help: "Alternative invalidation strategy for incremental compilation"
105105
category: "CFE"
106106

107+
value-class:
108+
help: "Value class"
107109
#
108110
# Flags below this line are shipped, retired, or rejected, cannot be specified
109111
# on the command line, and will eventually be removed.

0 commit comments

Comments
 (0)