Elements. Remove FieldElementOrMember.
Change-Id: Ied15d4796bc42e58e932fb2689be2d627a047d2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437520
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index cf4fa84..032d446 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -2945,16 +2945,6 @@
DartObject? computeConstantValue() => firstFragment.computeConstantValue();
}
-/// Common base class for all analyzer-internal classes that implement
-/// `FieldElement`.
-abstract class FieldElementOrMember implements PropertyInducingElementOrMember {
- @override
- FieldFragmentImpl get declaration;
-
- @override
- TypeImpl get type;
-}
-
class FieldFormalParameterElementImpl extends FormalParameterElementImpl
implements FieldFormalParameterElement {
FieldFormalParameterElementImpl(super.firstFragment);
@@ -3032,7 +3022,7 @@
class FieldFragmentImpl extends PropertyInducingFragmentImpl
with ConstVariableFragment
- implements FieldElementOrMember, FieldFragment {
+ implements FieldFragment {
/// True if this field inherits from a covariant parameter. This happens
/// when it overrides a field in a supertype that is covariant.
bool inheritsCovariant = false;
diff --git a/pkg/analyzer/lib/src/dart/element/member.dart b/pkg/analyzer/lib/src/dart/element/member.dart
index 0df1d90..ec1ce0b 100644
--- a/pkg/analyzer/lib/src/dart/element/member.dart
+++ b/pkg/analyzer/lib/src/dart/element/member.dart
@@ -450,8 +450,7 @@
/// A field element defined in a parameterized type where the values of the type
/// parameters are known.
-class FieldMember extends VariableMember
- implements FieldElementOrMember, FieldElement2OrMember {
+class FieldMember extends VariableMember implements FieldElement2OrMember {
/// Initialize a newly created element to represent a field, based on the
/// [declaration], with applied [substitution].
FieldMember({
@@ -617,16 +616,6 @@
substitution: substitution,
);
}
-
- static FieldElementOrMember from2(
- FieldFragmentImpl element,
- MapSubstitution substitution,
- ) {
- if (substitution.map.isEmpty) {
- return element;
- }
- return FieldMember(declaration: element, substitution: substitution);
- }
}
/// A getter element defined in a parameterized type where the values of the
diff --git a/pkg/analyzer/lib/src/utilities/extensions/element.dart b/pkg/analyzer/lib/src/utilities/extensions/element.dart
index 4ea6bd8..fa0b19c 100644
--- a/pkg/analyzer/lib/src/utilities/extensions/element.dart
+++ b/pkg/analyzer/lib/src/utilities/extensions/element.dart
@@ -247,16 +247,6 @@
}
}
-extension FieldElementOrMemberExtension on FieldElementOrMember {
- FieldElement2OrMember get asElement2 {
- return switch (this) {
- FieldFragmentImpl(:var element) => element,
- FieldMember member => member,
- _ => throw UnsupportedError('Unsupported type: $runtimeType'),
- };
- }
-}
-
extension FormalParameterElementExtension on FormalParameterElement {
void appendToWithoutDelimiters(
StringBuffer buffer, {