Stop using deprecated 'element2' that will be removed.

See https://dart-review.googlesource.com/c/sdk/+/311461

Change-Id: I7c2b7ff227fef838f10657bdd9f18da98f48f5ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332061
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Konstantin Shcheglov 2023-10-25 14:21:42 +00:00 committed by Commit Queue
parent e06536af2e
commit d07ab72fb9
2 changed files with 11 additions and 11 deletions

View file

@ -913,8 +913,8 @@ void filterOperators(Set<InterfaceType> allTypes) {
bool isExcludedMethod(InterfaceType tp, MethodElement method) {
// TODO(bkonyi): Enable operator / for these types after we resolve
// https://github.com/dart-lang/sdk/issues/39890
if (((tp.element2.name == 'Float32x4') && (method.name == '/')) ||
((tp.element2.name == 'Float64x2') && (method.name == '/'))) {
if (((tp.element.name == 'Float32x4') && (method.name == '/')) ||
((tp.element.name == 'Float64x2') && (method.name == '/'))) {
return true;
}
return false;
@ -1107,7 +1107,7 @@ bool shouldFilterConstructor(InterfaceType tp, ConstructorElement cons) {
// Constructor exclude list
// TODO(bkonyi): Enable Float32x4.fromInt32x4Bits after we resolve
// https://github.com/dart-lang/sdk/issues/39890
if ((tp.element2.name == 'Float32x4') && (cons.name == 'fromInt32x4Bits')) {
if ((tp.element.name == 'Float32x4') && (cons.name == 'fromInt32x4Bits')) {
return true;
}
return false;
@ -1231,7 +1231,7 @@ Set<InterfaceType> instantiatePTypes(
} else {
return;
}
InterfaceType ptx = pType.element2.instantiate(
InterfaceType ptx = pType.element.instantiate(
typeArguments: [iType],
nullabilitySuffix: NullabilitySuffix.star,
);
@ -1252,7 +1252,7 @@ Set<InterfaceType> instantiatePTypes(
} else {
return;
}
InterfaceType ptx = pType.element2.instantiate(
InterfaceType ptx = pType.element.instantiate(
typeArguments: [iType1, iType2],
nullabilitySuffix: NullabilitySuffix.star,
);
@ -1286,7 +1286,7 @@ Set<InterfaceType> instantiateAllTypes(
// complex types like Int8List.
var filteredITypes = <InterfaceType>{};
for (var iType in iTypes) {
if (iTypeFilter.contains(iType.element2.name)) {
if (iTypeFilter.contains(iType.element.name)) {
filteredITypes.add(iType);
}
}
@ -1324,7 +1324,7 @@ int countOperators(InterfaceElement ce) {
no += 100;
}
for (var ci in ce.interfaces) {
no += countOperators(ci.element2);
no += countOperators(ci.element);
}
});
return no;
@ -1429,7 +1429,7 @@ void getInterfaceRels(Set<InterfaceType> allTypes) {
iterableTypes1.add(typName);
}
}
for (var it in tp.element2.allSupertypes) {
for (var it in tp.element.allSupertypes) {
var ifTypName = typeConstName(it);
interfaceRels[ifTypName] ??= <String>{};
interfaceRels[ifTypName]!.add(typName);

View file

@ -58,15 +58,15 @@ extension DartTypeExtension on DartType {
final typeArguments = type.typeArguments;
if (typeArguments.isEmpty ||
typeArguments.every((t) => t is DynamicType)) {
return type.element2.name;
return type.element.name;
} else {
final typeArgumentsStr = typeArguments.map((t) => t.asCode).join(', ');
return '${type.element2.name}<$typeArgumentsStr>';
return '${type.element.name}<$typeArgumentsStr>';
}
} else if (type is NeverType) {
return 'Never';
} else if (type is TypeParameterType) {
return type.element2.name;
return type.element.name;
} else if (type is VoidType) {
return 'void';
} else {