Skip to content

Commit 4f7eca8

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Remove V1 DartType.element
Change-Id: I209f3bd15f71b1035121833cce6244ef5ebe61e5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423360 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 9fbed46 commit 4f7eca8

File tree

3 files changed

+8
-95
lines changed

3 files changed

+8
-95
lines changed

pkg/analyzer/api.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4192,7 +4192,6 @@ package:analyzer/dart/element/type.dart:
41924192
DartType (class extends Object):
41934193
new (constructor: DartType Function())
41944194
alias (getter: InstantiatedTypeAliasElement?)
4195-
element (getter: Element?, deprecated)
41964195
element3 (getter: Element2?, experimental)
41974196
extensionTypeErasure (getter: DartType)
41984197
isBottom (getter: bool)
@@ -4227,7 +4226,7 @@ package:analyzer/dart/element/type.dart:
42274226
new (constructor: DynamicType Function())
42284227
FunctionType (class extends Object implements DartType):
42294228
new (constructor: FunctionType Function())
4230-
element (getter: Null)
4229+
element3 (getter: Null)
42314230
formalParameters (getter: List<FormalParameterElement>, experimental)
42324231
namedParameterTypes (getter: Map<String, DartType>)
42334232
normalParameterTypes (getter: List<DartType>)
@@ -4250,7 +4249,6 @@ package:analyzer/dart/element/type.dart:
42504249
accessors (getter: List<PropertyAccessorElement>, deprecated)
42514250
allSupertypes (getter: List<InterfaceType>)
42524251
constructors2 (getter: List<ConstructorElement2>, experimental)
4253-
element (getter: InterfaceElement, deprecated)
42544252
element3 (getter: InterfaceElement2, experimental)
42554253
getters (getter: List<GetterElement>, experimental)
42564254
interfaces (getter: List<InterfaceType>)
@@ -4282,7 +4280,7 @@ package:analyzer/dart/element/type.dart:
42824280
typeArguments (getter: List<DartType>)
42834281
RecordType (class extends Object implements DartType):
42844282
new (constructor: RecordType Function({required Map<String, DartType> named, required NullabilitySuffix nullabilitySuffix, required List<DartType> positional}))
4285-
element (getter: Null)
4283+
element3 (getter: Null)
42864284
namedFields (getter: List<RecordTypeNamedField>)
42874285
positionalFields (getter: List<RecordTypePositionalField>)
42884286
positionalTypes (getter: List<DartType>, deprecated)
@@ -4298,12 +4296,10 @@ package:analyzer/dart/element/type.dart:
42984296
TypeParameterType (class extends Object implements DartType):
42994297
new (constructor: TypeParameterType Function())
43004298
bound (getter: DartType)
4301-
definition (getter: ElementLocation, deprecated)
4302-
element (getter: TypeParameterElement, deprecated)
43034299
element3 (getter: TypeParameterElement2, experimental)
43044300
VoidType (class extends Object implements DartType):
43054301
new (constructor: VoidType Function())
4306-
element (getter: Null)
4302+
element3 (getter: Null)
43074303
package:analyzer/dart/element/type_provider.dart:
43084304
TypeProvider (class extends Object):
43094305
new (constructor: TypeProvider Function())

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

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ abstract class DartType {
3737
/// Otherwise return `null`.
3838
InstantiatedTypeAliasElement? get alias;
3939

40-
/// Return the element representing the declaration of this type, or `null`
41-
/// if the type is not associated with an element.
42-
@Deprecated('Use element3 instead')
43-
Element? get element;
44-
4540
/// Return the element representing the declaration of this type, or `null`
4641
/// if the type is not associated with an element.
4742
@experimental
@@ -238,7 +233,7 @@ abstract class DynamicType implements DartType {}
238233
/// Clients may not extend, implement or mix-in this class.
239234
abstract class FunctionType implements DartType {
240235
@override
241-
Null get element;
236+
Null get element3;
242237

243238
/// The formal parameters.
244239
@experimental
@@ -356,10 +351,6 @@ abstract class InterfaceType implements ParameterizedType {
356351
@experimental
357352
List<ConstructorElement2> get constructors2;
358353

359-
@Deprecated('Use element3 instead')
360-
@override
361-
InterfaceElement get element;
362-
363354
@experimental
364355
@override
365356
InterfaceElement2 get element3;
@@ -607,7 +598,7 @@ abstract class RecordType implements DartType {
607598
}) = RecordTypeImpl.fromApi;
608599

609600
@override
610-
Null get element;
601+
Null get element3;
611602

612603
/// The named fields (might be empty).
613604
List<RecordTypeNamedField> get namedFields;
@@ -663,18 +654,6 @@ abstract class TypeParameterType implements DartType {
663654
/// or `dynamic` if there was no explicit bound.
664655
DartType get bound;
665656

666-
/// An object that can be used to identify this type parameter with `==`.
667-
///
668-
/// Depending on the use, [bound] may also need to be taken into account.
669-
/// A given type parameter, it may have different bounds in different scopes.
670-
/// Always consult the bound if that could be relevant.
671-
@Deprecated('Elements are equal when they are identical')
672-
ElementLocation get definition;
673-
674-
@Deprecated('Use element3 instead')
675-
@override
676-
TypeParameterElement get element;
677-
678657
@experimental
679658
@override
680659
TypeParameterElement2 get element3;
@@ -684,5 +663,5 @@ abstract class TypeParameterType implements DartType {
684663
/// expression is meaningless, and intended to be discarded.
685664
abstract class VoidType implements DartType {
686665
@override
687-
Null get element;
666+
Null get element3;
688667
}

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

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ class DynamicTypeImpl extends TypeImpl
4040
/// Prevent the creation of instances of this class.
4141
DynamicTypeImpl._();
4242

43-
@Deprecated('Use element2 instead')
44-
@override
45-
DynamicElementImpl get element => DynamicElementImpl.instance;
46-
4743
@override
4844
DynamicElementImpl2 get element3 => DynamicElementImpl2.instance;
4945

@@ -194,10 +190,6 @@ class FunctionTypeImpl extends TypeImpl
194190
super.alias,
195191
});
196192

197-
@Deprecated('Use element2 instead')
198-
@override
199-
Null get element => null;
200-
201193
@override
202194
Null get element3 => null;
203195

@@ -666,10 +658,6 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
666658
}).toFixedList();
667659
}
668660

669-
@Deprecated('Use element3 instead')
670-
@override
671-
InterfaceElementImpl get element => element3.asElement;
672-
673661
@override
674662
List<GetterElement2OrMember> get getters {
675663
return _getters ??= element3.getters2.map((e) {
@@ -793,7 +781,7 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
793781

794782
@Deprecated('Check element, or use getDisplayString()')
795783
@override
796-
String get name => element.name;
784+
String get name => element3.name3!;
797785

798786
/// The instantiated representation type, if [element3] is an extension type.
799787
TypeImpl? get representationType {
@@ -873,23 +861,6 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
873861
builder.writeInterfaceType(this);
874862
}
875863

876-
@Deprecated('Use asInstanceOf2() instead')
877-
@override
878-
InterfaceTypeImpl? asInstanceOf(InterfaceElement targetElement) {
879-
if (element == targetElement) {
880-
return this;
881-
}
882-
883-
for (var rawInterface in element.allSupertypes) {
884-
if (rawInterface.element == targetElement) {
885-
var substitution = Substitution.fromInterfaceType(this);
886-
return substitution.mapInterfaceType(rawInterface);
887-
}
888-
}
889-
890-
return null;
891-
}
892-
893864
@override
894865
InterfaceTypeImpl? asInstanceOf2(InterfaceElement2 targetElement) {
895866
if (element3 == targetElement) {
@@ -1182,10 +1153,6 @@ class InvalidTypeImpl extends TypeImpl
11821153
/// Prevent the creation of instances of this class.
11831154
InvalidTypeImpl._();
11841155

1185-
@Deprecated('Use element2 instead')
1186-
@override
1187-
Null get element => null;
1188-
11891156
@override
11901157
Null get element3 => null;
11911158

@@ -1235,9 +1202,6 @@ class NeverTypeImpl extends TypeImpl implements NeverType {
12351202
/// The unique instance of this class, non-nullable.
12361203
static final NeverTypeImpl instance = NeverTypeImpl._(NullabilitySuffix.none);
12371204

1238-
@override
1239-
final NeverElementImpl element = NeverElementImpl.instance;
1240-
12411205
@override
12421206
final NeverElementImpl2 element3 = NeverElementImpl2.instance;
12431207

@@ -1364,10 +1328,6 @@ class RecordTypeImpl extends TypeImpl implements RecordType, SharedRecordType {
13641328
);
13651329
}
13661330

1367-
@Deprecated('Use element2 instead')
1368-
@override
1369-
Null get element => null;
1370-
13711331
@override
13721332
Null get element3 => null;
13731333

@@ -1524,10 +1484,6 @@ abstract class TypeImpl implements DartType, SharedType {
15241484
/// Initialize a newly created type.
15251485
const TypeImpl({this.alias});
15261486

1527-
@Deprecated('Use element3 instead')
1528-
@override
1529-
Element? get element => element3?.asElement;
1530-
15311487
@override
15321488
TypeImpl get extensionTypeErasure {
15331489
return const ExtensionTypeErasure().perform(this);
@@ -1702,14 +1658,6 @@ class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
17021658
TypeImpl get bound =>
17031659
promotedBound ?? element3.bound ?? DynamicTypeImpl.instance;
17041660

1705-
@Deprecated('Elements are equal when they are identical')
1706-
@override
1707-
ElementLocation get definition => element.location;
1708-
1709-
@Deprecated('Use element3 instead')
1710-
@override
1711-
TypeParameterElementImpl get element => element3.asElement;
1712-
17131661
@override
17141662
int get hashCode => element3.hashCode;
17151663

@@ -1737,7 +1685,7 @@ class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
17371685

17381686
@Deprecated('Check element, or use getDisplayString()')
17391687
@override
1740-
String get name => element.name;
1688+
String get name => element3.name3!;
17411689

17421690
TypeParameterTypeImpl get withoutPromotedBound {
17431691
return TypeParameterTypeImpl(
@@ -1791,12 +1739,6 @@ class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType {
17911739
return bound.asInstanceOf2(targetElement);
17921740
}
17931741

1794-
@Deprecated('Use referencesAny2() instead')
1795-
@override
1796-
bool referencesAny(Set<TypeParameterElement> parameters) {
1797-
return parameters.contains(element);
1798-
}
1799-
18001742
@override
18011743
bool referencesAny2(Set<TypeParameterElementImpl2> parameters) {
18021744
return parameters.contains(element3);
@@ -1821,10 +1763,6 @@ class VoidTypeImpl extends TypeImpl implements VoidType, SharedVoidType {
18211763
/// Prevent the creation of instances of this class.
18221764
VoidTypeImpl._();
18231765

1824-
@Deprecated('Use element2 instead')
1825-
@override
1826-
Null get element => null;
1827-
18281766
@override
18291767
Null get element3 => null;
18301768

0 commit comments

Comments
 (0)