Skip to content

Commit bdf8c21

Browse files
stereotype441Commit Queue
authored andcommitted
[analyzer] Use Impl types in TypeProviderImpl.
Change the methods in `TypeProviderImpl` so that their return types are all "Impl" types rather than analyzer public API types. This doesn't change the analyzer public API; it simply ensures that clients of `TypeProviderImpl` within the analyzer itself won't have to perform typecasts on the returned values in order to access the Impl classes. This is part of a larger arc of work to change the analyzer's use of the shared code so that the type parameters it supplies are not part of the analyzer public API (See #59763). This change will reduce the number of type casts that have to be done in order to pass `TypeImpl` types to shared code rather than `DartType` types. Change-Id: Ia351c3e8893cf10671b04b813ee80ff2b3bda341 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402621 Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent adcc212 commit bdf8c21

File tree

4 files changed

+154
-159
lines changed

4 files changed

+154
-159
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ class CompilationUnitElementImpl extends UriReferencedElementImpl
11911191
}
11921192

11931193
@override
1194-
ClassElement? getClass(String className) {
1194+
ClassElementImpl? getClass(String className) {
11951195
for (var class_ in classes) {
11961196
if (class_.name == className) {
11971197
return class_;
@@ -5900,11 +5900,11 @@ abstract class InterfaceElementImpl extends InstanceElementImpl
59005900

59015901
/// The non-nullable instance of this element, without alias.
59025902
/// Should be used only when the element has no type parameters.
5903-
InterfaceType? _nonNullableInstance;
5903+
InterfaceTypeImpl? _nonNullableInstance;
59045904

59055905
/// The nullable instance of this element, without alias.
59065906
/// Should be used only when the element has no type parameters.
5907-
InterfaceType? _nullableInstance;
5907+
InterfaceTypeImpl? _nullableInstance;
59085908

59095909
List<ConstructorElementImpl> _constructors = _Sentinel.constructorElement;
59105910

@@ -6077,7 +6077,7 @@ abstract class InterfaceElementImpl extends InstanceElementImpl
60776077
}
60786078

60796079
@override
6080-
InterfaceType instantiate({
6080+
InterfaceTypeImpl instantiate({
60816081
required List<DartType> typeArguments,
60826082
required NullabilitySuffix nullabilitySuffix,
60836083
}) {
@@ -7090,7 +7090,7 @@ class LibraryElementImpl extends ElementImpl
70907090
}
70917091

70927092
@override
7093-
ClassElement? getClass(String name) {
7093+
ClassElementImpl? getClass(String name) {
70947094
for (var unitElement in units) {
70957095
var element = unitElement.getClass(name);
70967096
if (element != null) {

0 commit comments

Comments
 (0)