add extension-methods experimental feature
Change-Id: Iad76a6d0b91ff83fce3dbd963d0c341b3b62eeb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102880
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
diff --git a/pkg/analyzer/lib/dart/analysis/features.dart b/pkg/analyzer/lib/dart/analysis/features.dart
index 6841054..575c7de 100644
--- a/pkg/analyzer/lib/dart/analysis/features.dart
+++ b/pkg/analyzer/lib/dart/analysis/features.dart
@@ -20,6 +20,9 @@
static const control_flow_collections =
ExperimentalFeatures.control_flow_collections;
+ /// Feature information for extension methods.
+ static const extension_methods = ExperimentalFeatures.extension_methods;
+
/// Feature information for spread collections.
static const spread_collections = ExperimentalFeatures.spread_collections;
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.dart
index 2cfdf21..c26eb6f 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.dart
@@ -33,6 +33,9 @@
/// String to enable the experiment "control-flow-collections"
static const String control_flow_collections = 'control-flow-collections';
+ /// String to enable the experiment "extension-methods"
+ static const String extension_methods = 'extension-methods';
+
/// String to enable the experiment "non-nullable"
static const String non_nullable = 'non-nullable';
@@ -98,15 +101,22 @@
IsExpired.triple_shift,
'Triple-shift operator');
- static const bogus_disabled = const ExperimentalFeature(
+ static const extension_methods = const ExperimentalFeature(
6,
+ EnableString.extension_methods,
+ IsEnabledByDefault.extension_methods,
+ IsExpired.extension_methods,
+ 'Extension Methods');
+
+ static const bogus_disabled = const ExperimentalFeature(
+ 7,
EnableString.bogus_disabled,
IsEnabledByDefault.bogus_disabled,
IsExpired.bogus_disabled,
null);
static const bogus_enabled = const ExperimentalFeature(
- 7,
+ 8,
EnableString.bogus_enabled,
IsEnabledByDefault.bogus_enabled,
IsExpired.bogus_enabled,
@@ -121,11 +131,12 @@
static const knownFeatures = <String, ExperimentalFeature>{
EnableString.constant_update_2018:
ExperimentalFeatures.constant_update_2018,
- EnableString.non_nullable: ExperimentalFeatures.non_nullable,
EnableString.control_flow_collections:
ExperimentalFeatures.control_flow_collections,
- EnableString.spread_collections: ExperimentalFeatures.spread_collections,
+ EnableString.extension_methods: ExperimentalFeatures.extension_methods,
+ EnableString.non_nullable: ExperimentalFeatures.non_nullable,
EnableString.set_literals: ExperimentalFeatures.set_literals,
+ EnableString.spread_collections: ExperimentalFeatures.spread_collections,
EnableString.triple_shift: ExperimentalFeatures.triple_shift,
EnableString.bogus_disabled: ExperimentalFeatures.bogus_disabled,
EnableString.bogus_enabled: ExperimentalFeatures.bogus_enabled,
@@ -138,6 +149,7 @@
ExperimentStatus(
{bool constant_update_2018,
bool control_flow_collections,
+ bool extension_methods,
bool non_nullable,
bool set_literals,
bool spread_collections,
@@ -149,6 +161,7 @@
true, // spread-collections
true, // set-literals
triple_shift ?? IsEnabledByDefault.triple_shift,
+ extension_methods ?? IsEnabledByDefault.extension_methods,
false, // bogus-disabled
true, // bogus-enabled
];
@@ -188,6 +201,10 @@
bool get control_flow_collections =>
isEnabled(ExperimentalFeatures.control_flow_collections);
+ /// Current state for the flag "extension_methods"
+ bool get extension_methods =>
+ isEnabled(ExperimentalFeatures.extension_methods);
+
@override
int get hashCode {
int hash = 0;
@@ -248,6 +265,9 @@
/// Default state of the experiment "control-flow-collections"
static const bool control_flow_collections = true;
+ /// Default state of the experiment "extension-methods"
+ static const bool extension_methods = false;
+
/// Default state of the experiment "non-nullable"
static const bool non_nullable = false;
@@ -277,6 +297,9 @@
/// Expiration status of the experiment "control-flow-collections"
static const bool control_flow_collections = true;
+ /// Expiration status of the experiment "extension-methods"
+ static const bool extension_methods = false;
+
/// Expiration status of the experiment "non-nullable"
static const bool non_nullable = false;