Skip to content

Commit 157a0f0

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Remove V1 ExtensionElement, ExtensionTypeElement.
Change-Id: I079d3cca39c89864aba56af63e2f19f9eeebac38 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423164 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent a86bb02 commit 157a0f0

File tree

3 files changed

+2
-224
lines changed

3 files changed

+2
-224
lines changed

pkg/analyzer/api.txt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2958,15 +2958,6 @@ package:analyzer/dart/constant/value.dart:
29582958
toSymbolValue (method: String? Function())
29592959
toTypeValue (method: DartType? Function())
29602960
package:analyzer/dart/element/element.dart:
2961-
AugmentedExtensionElement (class extends Object implements AugmentedInstanceElement, deprecated):
2962-
new (constructor: AugmentedExtensionElement Function())
2963-
extendedType (getter: DartType)
2964-
AugmentedExtensionTypeElement (class extends Object implements AugmentedInterfaceElement, deprecated):
2965-
new (constructor: AugmentedExtensionTypeElement Function())
2966-
firstFragment (getter: ExtensionTypeElement)
2967-
primaryConstructor (getter: ConstructorElement)
2968-
representation (getter: FieldElement)
2969-
typeErasure (getter: DartType)
29702961
AugmentedInstanceElement (class extends Object, deprecated):
29712962
new (constructor: AugmentedInstanceElement Function())
29722963
accessors (getter: List<PropertyAccessorElement>)
@@ -3002,11 +2993,8 @@ package:analyzer/dart/element/element.dart:
30022993
isStatic (getter: bool)
30032994
CompilationUnitElement (class extends Object implements UriReferencedElement, deprecated):
30042995
new (constructor: CompilationUnitElement Function())
3005-
accessibleExtensions (getter: List<ExtensionElement>)
30062996
accessors (getter: List<PropertyAccessorElement>)
30072997
enclosingElement3 (getter: CompilationUnitElement?)
3008-
extensionTypes (getter: List<ExtensionTypeElement>, experimental)
3009-
extensions (getter: List<ExtensionElement>)
30102998
functions (getter: List<FunctionElement>)
30112999
libraryExports (getter: List<LibraryExportElement>)
30123000
libraryImportPrefixes (getter: List<PrefixElement>)
@@ -3209,20 +3197,6 @@ package:analyzer/dart/element/element.dart:
32093197
isStatic (getter: bool)
32103198
isSynchronous (getter: bool)
32113199
name (getter: String)
3212-
ExtensionElement (class extends Object implements InstanceElement, deprecated):
3213-
new (constructor: ExtensionElement Function())
3214-
augmented (getter: AugmentedExtensionElement, deprecated)
3215-
extendedType (getter: DartType)
3216-
getField (method: FieldElement? Function(String))
3217-
getGetter (method: PropertyAccessorElement? Function(String))
3218-
getMethod (method: MethodElement? Function(String))
3219-
getSetter (method: PropertyAccessorElement? Function(String))
3220-
ExtensionTypeElement (class extends Object implements InterfaceElement, deprecated):
3221-
new (constructor: ExtensionTypeElement Function())
3222-
augmented (getter: AugmentedExtensionTypeElement, deprecated)
3223-
primaryConstructor (getter: ConstructorElement, deprecated)
3224-
representation (getter: FieldElement)
3225-
typeErasure (getter: DartType)
32263200
FieldElement (class extends Object implements ClassMemberElement, PropertyInducingElement, deprecated):
32273201
new (constructor: FieldElement Function())
32283202
declaration (getter: FieldElement)

pkg/analyzer/lib/dart/element/element.dart

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -60,36 +60,6 @@ import 'package:analyzer/src/task/api/model.dart' show AnalysisTarget;
6060
import 'package:meta/meta.dart';
6161
import 'package:pub_semver/pub_semver.dart';
6262

63-
/// The result of applying augmentations to an [ExtensionElement].
64-
///
65-
/// Clients may not extend, implement or mix-in this class.
66-
@Deprecated(elementModelDeprecationMsg)
67-
abstract class AugmentedExtensionElement implements AugmentedInstanceElement {
68-
/// The type that is extended by this extension.
69-
DartType get extendedType;
70-
}
71-
72-
/// The result of applying augmentations to an [ExtensionTypeElement].
73-
///
74-
/// Clients may not extend, implement or mix-in this class.
75-
@Deprecated(elementModelDeprecationMsg)
76-
abstract class AugmentedExtensionTypeElement
77-
implements AugmentedInterfaceElement {
78-
@override
79-
ExtensionTypeElement get firstFragment;
80-
81-
/// The primary constructor of this extension.
82-
ConstructorElement get primaryConstructor;
83-
84-
/// The representation of this extension.
85-
FieldElement get representation;
86-
87-
/// The extension type erasure, obtained by recursively replacing every
88-
/// subterm which is an extension type by the corresponding representation
89-
/// type.
90-
DartType get typeErasure;
91-
}
92-
9363
/// The result of applying augmentations to a [InstanceElement].
9464
///
9565
/// Clients may not extend, implement or mix-in this class.
@@ -255,9 +225,6 @@ abstract class ClassMemberElement implements Element {
255225
/// Clients may not extend, implement or mix-in this class.
256226
@Deprecated(elementModelDeprecationMsg)
257227
abstract class CompilationUnitElement implements UriReferencedElement {
258-
/// The extension elements accessible within this unit.
259-
List<ExtensionElement> get accessibleExtensions;
260-
261228
/// The top-level accessors (getters and setters) declared in this
262229
/// compilation unit.
263230
List<PropertyAccessorElement> get accessors;
@@ -267,13 +234,6 @@ abstract class CompilationUnitElement implements UriReferencedElement {
267234
@override
268235
CompilationUnitElement? get enclosingElement3;
269236

270-
/// The extensions declared in this compilation unit.
271-
List<ExtensionElement> get extensions;
272-
273-
/// The extension types declared in this compilation unit.
274-
@experimental
275-
List<ExtensionTypeElement> get extensionTypes;
276-
277237
/// The top-level functions declared in this compilation unit.
278238
List<FunctionElement> get functions;
279239

@@ -1106,61 +1066,6 @@ abstract class ExecutableElement implements FunctionTypedElement {
11061066
String get name;
11071067
}
11081068

1109-
/// An element that represents an extension.
1110-
///
1111-
/// Clients may not extend, implement or mix-in this class.
1112-
@Deprecated('Use ExtensionElement2 instead')
1113-
abstract class ExtensionElement implements InstanceElement {
1114-
@Deprecated(elementModelDeprecationMsg)
1115-
@override
1116-
AugmentedExtensionElement get augmented;
1117-
1118-
/// The type that is extended by this extension.
1119-
DartType get extendedType;
1120-
1121-
/// Returns the element representing the field with the given [name] that is
1122-
/// declared in this extension, or `null` if this extension does not declare a
1123-
/// field with the given name.
1124-
FieldElement? getField(String name);
1125-
1126-
/// Returns the element representing the getter with the given [name] that is
1127-
/// declared in this extension, or `null` if this extension does not declare a
1128-
/// getter with the given name.
1129-
PropertyAccessorElement? getGetter(String name);
1130-
1131-
/// Returns the element representing the method with the given [name] that is
1132-
/// declared in this extension, or `null` if this extension does not declare a
1133-
/// method with the given name.
1134-
MethodElement? getMethod(String name);
1135-
1136-
/// Returns the element representing the setter with the given [name] that is
1137-
/// declared in this extension, or `null` if this extension does not declare a
1138-
/// setter with the given name.
1139-
PropertyAccessorElement? getSetter(String name);
1140-
}
1141-
1142-
/// An element that represents an extension type.
1143-
///
1144-
/// Clients may not extend, implement or mix-in this class.
1145-
@Deprecated('Use ExtensionTypeElement2 instead')
1146-
abstract class ExtensionTypeElement implements InterfaceElement {
1147-
@Deprecated(elementModelDeprecationMsg)
1148-
@override
1149-
AugmentedExtensionTypeElement get augmented;
1150-
1151-
/// The primary constructor of this extension.
1152-
@Deprecated(elementModelDeprecationMsg)
1153-
ConstructorElement get primaryConstructor;
1154-
1155-
/// The representation of this extension.
1156-
FieldElement get representation;
1157-
1158-
/// The extension type erasure, obtained by recursively replacing every
1159-
/// subterm which is an extension type by the corresponding representation
1160-
/// type.
1161-
DartType get typeErasure;
1162-
}
1163-
11641069
/// A field defined within a class.
11651070
///
11661071
/// Clients may not extend, implement or mix-in this class.

pkg/analyzer/lib/src/dart/element/element.dart

Lines changed: 2 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -89,40 +89,6 @@ mixin AugmentableFragment on ElementImpl {
8989
}
9090
}
9191

92-
@Deprecated(elementModelDeprecationMsg)
93-
class AugmentedExtensionElementImpl extends AugmentedInstanceElementImpl
94-
implements AugmentedExtensionElement {
95-
AugmentedExtensionElementImpl(super.firstFragment);
96-
97-
@override
98-
DartType get extendedType => firstFragment.extendedType;
99-
100-
@override
101-
ExtensionElementImpl get firstFragment {
102-
return super.firstFragment as ExtensionElementImpl;
103-
}
104-
}
105-
106-
@Deprecated(elementModelDeprecationMsg)
107-
class AugmentedExtensionTypeElementImpl extends AugmentedInterfaceElementImpl
108-
implements AugmentedExtensionTypeElement {
109-
AugmentedExtensionTypeElementImpl(super.firstFragment);
110-
111-
@override
112-
ExtensionTypeElementImpl get firstFragment {
113-
return super.firstFragment as ExtensionTypeElementImpl;
114-
}
115-
116-
@override
117-
ConstructorElement get primaryConstructor => firstFragment.primaryConstructor;
118-
119-
@override
120-
FieldElement get representation => firstFragment.representation;
121-
122-
@override
123-
DartType get typeErasure => firstFragment.typeErasure;
124-
}
125-
12692
@Deprecated(elementModelDeprecationMsg)
12793
class AugmentedInstanceElementImpl implements AugmentedInstanceElement {
12894
@override
@@ -902,14 +868,6 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
902868
required this.lineInfo,
903869
}) : super(null, -1);
904870

905-
@Deprecated('Use accessibleExtensions2 instead')
906-
@override
907-
List<ExtensionElement> get accessibleExtensions {
908-
return scope.accessibleExtensions
909-
.map((e) => e.firstFragment as ExtensionElement)
910-
.toList();
911-
}
912-
913871
@override
914872
List<ExtensionElement2> get accessibleExtensions2 {
915873
return scope.accessibleExtensions;
@@ -1009,7 +967,6 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
1009967
@override
1010968
List<EnumFragment> get enums2 => enums.cast<EnumFragment>();
1011969

1012-
@override
1013970
List<ExtensionElementImpl> get extensions {
1014971
return _extensions;
1015972
}
@@ -1027,7 +984,6 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
1027984
List<ExtensionFragment> get extensions2 =>
1028985
extensions.cast<ExtensionFragment>();
1029986

1030-
@override
1031987
List<ExtensionTypeElementImpl> get extensionTypes {
1032988
return _extensionTypes;
1033989
}
@@ -3943,22 +3899,14 @@ abstract class ExecutableElementOrMember
39433899
}
39443900

39453901
class ExtensionElementImpl extends InstanceElementImpl
3946-
implements
3947-
// ignore:deprecated_member_use_from_same_package,analyzer_use_new_elements
3948-
ExtensionElement,
3949-
ExtensionFragment {
3902+
implements ExtensionFragment {
39503903
late ExtensionElementImpl2 augmentedInternal;
39513904

39523905
/// Initialize a newly created extension element to have the given [name] at
39533906
/// the given [nameOffset] in the file that contains the declaration of this
39543907
/// element.
39553908
ExtensionElementImpl(super.name, super.nameOffset);
39563909

3957-
@Deprecated(elementModelDeprecationMsg)
3958-
@override
3959-
AugmentedExtensionElement get augmented =>
3960-
AugmentedExtensionElementImpl(this);
3961-
39623910
@Deprecated('Use Element2 instead')
39633911
@override
39643912
List<Element> get children => [
@@ -3986,7 +3934,6 @@ class ExtensionElementImpl extends InstanceElementImpl
39863934
return augmentedInternal;
39873935
}
39883936

3989-
@override
39903937
TypeImpl get extendedType {
39913938
return element.extendedType;
39923939
}
@@ -4029,43 +3976,6 @@ class ExtensionElementImpl extends InstanceElementImpl
40293976
void appendTo(ElementDisplayStringBuilder builder) {
40303977
builder.writeExtensionElement(this);
40313978
}
4032-
4033-
@Deprecated(elementModelDeprecationMsg)
4034-
@override
4035-
FieldElement? getField(String name) {
4036-
for (FieldElement fieldElement in fields) {
4037-
if (name == fieldElement.name) {
4038-
return fieldElement;
4039-
}
4040-
}
4041-
return null;
4042-
}
4043-
4044-
@override
4045-
PropertyAccessorElementOrMember? getGetter(String getterName) {
4046-
for (var accessor in accessors) {
4047-
if (accessor.isGetter && accessor.name == getterName) {
4048-
return accessor;
4049-
}
4050-
}
4051-
return null;
4052-
}
4053-
4054-
@override
4055-
MethodElementOrMember? getMethod(String methodName) {
4056-
for (var method in methods) {
4057-
if (method.name == methodName) {
4058-
return method;
4059-
}
4060-
}
4061-
return null;
4062-
}
4063-
4064-
@Deprecated(elementModelDeprecationMsg)
4065-
@override
4066-
PropertyAccessorElement? getSetter(String setterName) {
4067-
return InterfaceElementImpl.getSetterFromAccessors(setterName, accessors);
4068-
}
40693979
}
40703980

40713981
class ExtensionElementImpl2 extends InstanceElementImpl2
@@ -4105,13 +4015,9 @@ class ExtensionElementImpl2 extends InstanceElementImpl2
41054015
}
41064016

41074017
class ExtensionTypeElementImpl extends InterfaceElementImpl
4108-
implements
4109-
// ignore:deprecated_member_use_from_same_package,analyzer_use_new_elements
4110-
ExtensionTypeElement,
4111-
ExtensionTypeFragment {
4018+
implements ExtensionTypeFragment {
41124019
late ExtensionTypeElementImpl2 augmentedInternal;
41134020

4114-
@override
41154021
late DartType typeErasure;
41164022

41174023
/// Whether the element has direct or indirect reference to itself,
@@ -4124,11 +4030,6 @@ class ExtensionTypeElementImpl extends InterfaceElementImpl
41244030

41254031
ExtensionTypeElementImpl(super.name, super.nameOffset);
41264032

4127-
@Deprecated(elementModelDeprecationMsg)
4128-
@override
4129-
AugmentedExtensionTypeElement get augmented =>
4130-
AugmentedExtensionTypeElementImpl(this);
4131-
41324033
@override
41334034
ExtensionTypeElementImpl2 get element {
41344035
linkedData?.read(this);
@@ -4148,7 +4049,6 @@ class ExtensionTypeElementImpl extends InterfaceElementImpl
41484049
ExtensionTypeElementImpl? get previousFragment =>
41494050
super.previousFragment as ExtensionTypeElementImpl?;
41504051

4151-
@override
41524052
ConstructorElementImpl get primaryConstructor {
41534053
return constructors.first;
41544054
}
@@ -4157,7 +4057,6 @@ class ExtensionTypeElementImpl extends InterfaceElementImpl
41574057
ConstructorFragment get primaryConstructor2 =>
41584058
primaryConstructor as ConstructorFragment;
41594059

4160-
@override
41614060
FieldElementImpl get representation {
41624061
return fields.first;
41634062
}

0 commit comments

Comments
 (0)