Elements. Export LocalVariableElementImpl2.wrappedElement

Change-Id: I8742dc8cf82c7144e501afbbf0755651f414b00f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388072
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index e601314..22e9b51 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -8242,6 +8242,9 @@
   @experimental
   @override
   bool isPotentiallyMutatedInScope2(VariableElement2 variable) {
+    if (variable is LocalVariableElementImpl2) {
+      return isPotentiallyMutatedInScope(variable.wrappedElement);
+    }
     if (variable case VariableElement variable) {
       return isPotentiallyMutatedInScope(variable);
     }
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index a697900..3333178 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -6642,6 +6642,10 @@
   @override
   DartType get type => _wrappedElement.type;
 
+  LocalVariableElementImpl get wrappedElement {
+    return _wrappedElement;
+  }
+
   @override
   DartObject? computeConstantValue() => _wrappedElement.computeConstantValue();
 }