Elements. Deprecate LabelElement.

Change-Id: I9cccfd231d357a8a2b84f4cdde4ff5768c05c5b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418916
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/api.txt b/pkg/analyzer/api.txt
index d7f8ac7..86755ad 100644
--- a/pkg/analyzer/api.txt
+++ b/pkg/analyzer/api.txt
@@ -3365,7 +3365,7 @@
     new (constructor: JoinPatternVariableElement Function())
     isConsistent (getter: bool)
     variables (getter: List<PatternVariableElement>)
-  LabelElement (class extends Object implements Element):
+  LabelElement (class extends Object implements Element, deprecated):
     new (constructor: LabelElement Function())
     enclosingElement3 (getter: ExecutableElement, deprecated)
     name (getter: String)
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index a502189..c858ca8 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -1635,6 +1635,7 @@
 /// A label associated with a statement.
 ///
 /// Clients may not extend, implement or mix-in this class.
+@Deprecated('Use LabelElement2 instead')
 abstract class LabelElement implements Element {
   @Deprecated(elementModelDeprecationMsg)
   @override
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 3a05f33..691126f 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -6817,9 +6817,11 @@
       super._wrappedElement as JoinPatternVariableElementImpl;
 }
 
-/// A concrete implementation of a [LabelElement].
 class LabelElementImpl extends ElementImpl
-    implements LabelElement, LabelFragment {
+    implements
+        // ignore:deprecated_member_use_from_same_package
+        LabelElement,
+        LabelFragment {
   late final LabelElementImpl2 element2 = LabelElementImpl2(this);
 
   /// A flag indicating whether this label is associated with a `switch` member
diff --git a/pkg/analyzer/lib/src/utilities/extensions/element.dart b/pkg/analyzer/lib/src/utilities/extensions/element.dart
index 920dc2d..d9aa290 100644
--- a/pkg/analyzer/lib/src/utilities/extensions/element.dart
+++ b/pkg/analyzer/lib/src/utilities/extensions/element.dart
@@ -462,12 +462,6 @@
   }
 }
 
-extension LabelElement2Extension on LabelElement2 {
-  LabelElement get asElement {
-    return firstFragment as LabelElement;
-  }
-}
-
 extension LibraryElement2Extension on LibraryElement2 {
   LibraryElement get asElement {
     return this as LibraryElement;