mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
Add "enhanced-enums" experiment flag
Part of https://github.com/dart-lang/sdk/issues/47453. Change-Id: I6d1fdc4bc170354985a9d216b13ad8f153717adf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216662 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Chloe Stefantsova <dmitryas@google.com>
This commit is contained in:
parent
2d2dace5cd
commit
cfa5d6cdcb
|
@ -17,6 +17,7 @@ final _knownFeatures = <String, ExperimentalFeature>{
|
|||
EnableString.constructor_tearoffs: ExperimentalFeatures.constructor_tearoffs,
|
||||
EnableString.control_flow_collections:
|
||||
ExperimentalFeatures.control_flow_collections,
|
||||
EnableString.enhanced_enums: ExperimentalFeatures.enhanced_enums,
|
||||
EnableString.extension_methods: ExperimentalFeatures.extension_methods,
|
||||
EnableString.extension_types: ExperimentalFeatures.extension_types,
|
||||
EnableString.generic_metadata: ExperimentalFeatures.generic_metadata,
|
||||
|
@ -46,6 +47,9 @@ class EnableString {
|
|||
/// String to enable the experiment "control-flow-collections"
|
||||
static const String control_flow_collections = 'control-flow-collections';
|
||||
|
||||
/// String to enable the experiment "enhanced-enums"
|
||||
static const String enhanced_enums = 'enhanced-enums';
|
||||
|
||||
/// String to enable the experiment "extension-methods"
|
||||
static const String extension_methods = 'extension-methods';
|
||||
|
||||
|
@ -123,8 +127,18 @@ class ExperimentalFeatures {
|
|||
releaseVersion: Version.parse('2.0.0'),
|
||||
);
|
||||
|
||||
static final extension_methods = ExperimentalFeature(
|
||||
static final enhanced_enums = ExperimentalFeature(
|
||||
index: 4,
|
||||
enableString: EnableString.enhanced_enums,
|
||||
isEnabledByDefault: IsEnabledByDefault.enhanced_enums,
|
||||
isExpired: IsExpired.enhanced_enums,
|
||||
documentation: 'Enhanced Enums',
|
||||
experimentalReleaseVersion: null,
|
||||
releaseVersion: null,
|
||||
);
|
||||
|
||||
static final extension_methods = ExperimentalFeature(
|
||||
index: 5,
|
||||
enableString: EnableString.extension_methods,
|
||||
isEnabledByDefault: IsEnabledByDefault.extension_methods,
|
||||
isExpired: IsExpired.extension_methods,
|
||||
|
@ -134,7 +148,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final extension_types = ExperimentalFeature(
|
||||
index: 5,
|
||||
index: 6,
|
||||
enableString: EnableString.extension_types,
|
||||
isEnabledByDefault: IsEnabledByDefault.extension_types,
|
||||
isExpired: IsExpired.extension_types,
|
||||
|
@ -144,7 +158,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final generic_metadata = ExperimentalFeature(
|
||||
index: 6,
|
||||
index: 7,
|
||||
enableString: EnableString.generic_metadata,
|
||||
isEnabledByDefault: IsEnabledByDefault.generic_metadata,
|
||||
isExpired: IsExpired.generic_metadata,
|
||||
|
@ -155,7 +169,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final non_nullable = ExperimentalFeature(
|
||||
index: 7,
|
||||
index: 8,
|
||||
enableString: EnableString.non_nullable,
|
||||
isEnabledByDefault: IsEnabledByDefault.non_nullable,
|
||||
isExpired: IsExpired.non_nullable,
|
||||
|
@ -165,7 +179,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final nonfunction_type_aliases = ExperimentalFeature(
|
||||
index: 8,
|
||||
index: 9,
|
||||
enableString: EnableString.nonfunction_type_aliases,
|
||||
isEnabledByDefault: IsEnabledByDefault.nonfunction_type_aliases,
|
||||
isExpired: IsExpired.nonfunction_type_aliases,
|
||||
|
@ -175,7 +189,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final set_literals = ExperimentalFeature(
|
||||
index: 9,
|
||||
index: 10,
|
||||
enableString: EnableString.set_literals,
|
||||
isEnabledByDefault: IsEnabledByDefault.set_literals,
|
||||
isExpired: IsExpired.set_literals,
|
||||
|
@ -185,7 +199,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final spread_collections = ExperimentalFeature(
|
||||
index: 10,
|
||||
index: 11,
|
||||
enableString: EnableString.spread_collections,
|
||||
isEnabledByDefault: IsEnabledByDefault.spread_collections,
|
||||
isExpired: IsExpired.spread_collections,
|
||||
|
@ -195,7 +209,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final test_experiment = ExperimentalFeature(
|
||||
index: 11,
|
||||
index: 12,
|
||||
enableString: EnableString.test_experiment,
|
||||
isEnabledByDefault: IsEnabledByDefault.test_experiment,
|
||||
isExpired: IsExpired.test_experiment,
|
||||
|
@ -206,7 +220,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final triple_shift = ExperimentalFeature(
|
||||
index: 12,
|
||||
index: 13,
|
||||
enableString: EnableString.triple_shift,
|
||||
isEnabledByDefault: IsEnabledByDefault.triple_shift,
|
||||
isExpired: IsExpired.triple_shift,
|
||||
|
@ -216,7 +230,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final value_class = ExperimentalFeature(
|
||||
index: 13,
|
||||
index: 14,
|
||||
enableString: EnableString.value_class,
|
||||
isEnabledByDefault: IsEnabledByDefault.value_class,
|
||||
isExpired: IsExpired.value_class,
|
||||
|
@ -226,7 +240,7 @@ class ExperimentalFeatures {
|
|||
);
|
||||
|
||||
static final variance = ExperimentalFeature(
|
||||
index: 14,
|
||||
index: 15,
|
||||
enableString: EnableString.variance,
|
||||
isEnabledByDefault: IsEnabledByDefault.variance,
|
||||
isExpired: IsExpired.variance,
|
||||
|
@ -251,6 +265,9 @@ class IsEnabledByDefault {
|
|||
/// Default state of the experiment "control-flow-collections"
|
||||
static const bool control_flow_collections = true;
|
||||
|
||||
/// Default state of the experiment "enhanced-enums"
|
||||
static const bool enhanced_enums = false;
|
||||
|
||||
/// Default state of the experiment "extension-methods"
|
||||
static const bool extension_methods = true;
|
||||
|
||||
|
@ -301,6 +318,9 @@ class IsExpired {
|
|||
/// Expiration status of the experiment "control-flow-collections"
|
||||
static const bool control_flow_collections = true;
|
||||
|
||||
/// Expiration status of the experiment "enhanced-enums"
|
||||
static const bool enhanced_enums = false;
|
||||
|
||||
/// Expiration status of the experiment "extension-methods"
|
||||
static const bool extension_methods = false;
|
||||
|
||||
|
@ -351,6 +371,9 @@ mixin _CurrentState {
|
|||
bool get control_flow_collections =>
|
||||
isEnabled(ExperimentalFeatures.control_flow_collections);
|
||||
|
||||
/// Current state for the flag "enhanced-enums"
|
||||
bool get enhanced_enums => isEnabled(ExperimentalFeatures.enhanced_enums);
|
||||
|
||||
/// Current state for the flag "extension-methods"
|
||||
bool get extension_methods =>
|
||||
isEnabled(ExperimentalFeatures.extension_methods);
|
||||
|
|
|
@ -15,6 +15,7 @@ enum ExperimentalFlag {
|
|||
constantUpdate2018,
|
||||
constructorTearoffs,
|
||||
controlFlowCollections,
|
||||
enhancedEnums,
|
||||
extensionMethods,
|
||||
extensionTypes,
|
||||
genericMetadata,
|
||||
|
@ -34,6 +35,7 @@ const Version enableConstFunctionsVersion = const Version(2, 15);
|
|||
const Version enableConstantUpdate2018Version = const Version(2, 0);
|
||||
const Version enableConstructorTearoffsVersion = const Version(2, 15);
|
||||
const Version enableControlFlowCollectionsVersion = const Version(2, 0);
|
||||
const Version enableEnhancedEnumsVersion = const Version(2, 15);
|
||||
const Version enableExtensionMethodsVersion = const Version(2, 6);
|
||||
const Version enableExtensionTypesVersion = const Version(2, 15);
|
||||
const Version enableGenericMetadataVersion = const Version(2, 14);
|
||||
|
@ -58,6 +60,8 @@ ExperimentalFlag? parseExperimentalFlag(String flag) {
|
|||
return ExperimentalFlag.constructorTearoffs;
|
||||
case "control-flow-collections":
|
||||
return ExperimentalFlag.controlFlowCollections;
|
||||
case "enhanced-enums":
|
||||
return ExperimentalFlag.enhancedEnums;
|
||||
case "extension-methods":
|
||||
return ExperimentalFlag.extensionMethods;
|
||||
case "extension-types":
|
||||
|
@ -90,6 +94,7 @@ const Map<ExperimentalFlag, bool> defaultExperimentalFlags = {
|
|||
ExperimentalFlag.constantUpdate2018: true,
|
||||
ExperimentalFlag.constructorTearoffs: true,
|
||||
ExperimentalFlag.controlFlowCollections: true,
|
||||
ExperimentalFlag.enhancedEnums: false,
|
||||
ExperimentalFlag.extensionMethods: true,
|
||||
ExperimentalFlag.extensionTypes: false,
|
||||
ExperimentalFlag.genericMetadata: true,
|
||||
|
@ -109,6 +114,7 @@ const Map<ExperimentalFlag, bool> expiredExperimentalFlags = {
|
|||
ExperimentalFlag.constantUpdate2018: true,
|
||||
ExperimentalFlag.constructorTearoffs: false,
|
||||
ExperimentalFlag.controlFlowCollections: true,
|
||||
ExperimentalFlag.enhancedEnums: false,
|
||||
ExperimentalFlag.extensionMethods: false,
|
||||
ExperimentalFlag.extensionTypes: false,
|
||||
ExperimentalFlag.genericMetadata: false,
|
||||
|
@ -128,6 +134,7 @@ const Map<ExperimentalFlag, Version> experimentEnabledVersion = {
|
|||
ExperimentalFlag.constantUpdate2018: const Version(2, 0),
|
||||
ExperimentalFlag.constructorTearoffs: const Version(2, 15),
|
||||
ExperimentalFlag.controlFlowCollections: const Version(2, 0),
|
||||
ExperimentalFlag.enhancedEnums: const Version(2, 15),
|
||||
ExperimentalFlag.extensionMethods: const Version(2, 6),
|
||||
ExperimentalFlag.extensionTypes: const Version(2, 15),
|
||||
ExperimentalFlag.genericMetadata: const Version(2, 14),
|
||||
|
@ -147,6 +154,7 @@ const Map<ExperimentalFlag, Version> experimentReleasedVersion = {
|
|||
ExperimentalFlag.constantUpdate2018: const Version(2, 0),
|
||||
ExperimentalFlag.constructorTearoffs: const Version(2, 15),
|
||||
ExperimentalFlag.controlFlowCollections: const Version(2, 0),
|
||||
ExperimentalFlag.enhancedEnums: const Version(2, 15),
|
||||
ExperimentalFlag.extensionMethods: const Version(2, 6),
|
||||
ExperimentalFlag.extensionTypes: const Version(2, 15),
|
||||
ExperimentalFlag.genericMetadata: const Version(2, 14),
|
||||
|
|
|
@ -122,6 +122,9 @@ features:
|
|||
const-functions:
|
||||
help: "Allow more of the Dart language to be executed in const expressions."
|
||||
|
||||
enhanced-enums:
|
||||
help: "Enhanced Enums"
|
||||
|
||||
# Experiment flag only used for testing.
|
||||
test-experiment:
|
||||
help: >-
|
||||
|
|
Loading…
Reference in a new issue