Skip to content

Commit 1400bd0

Browse files
fshcheglovCommit Queue
authored andcommitted
Deprecate type_provider's getters ending in 2, and rename TypeProviderImpl.functionElement2 to functionElement.
Change-Id: Iac9659aaed0dcd92e4cf13f9859dea2bf7b47f47 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437582 Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent fba6ec3 commit 1400bd0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+433
-211
lines changed

pkg/analysis_server/lib/src/services/correction/dart/add_diagnostic_property_reference.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class AddDiagnosticPropertyReference extends ResolvedCorrectionProducer {
429429
}
430430

431431
bool _isIterable(DartType type) {
432-
return type.asInstanceOf2(typeProvider.iterableElement2) != null;
432+
return type.asInstanceOf2(typeProvider.iterableElement) != null;
433433
}
434434

435435
({int offset, String prefix}) _offsetAndPrefixOfBlock(Block block) {

pkg/analysis_server/lib/src/services/correction/dart/add_null_check.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ class AddNullCheck extends ResolvedCorrectionProducer {
130130
var literal = parent.thisOrAncestorOfType<TypedLiteral>();
131131
if (literal is ListLiteral) {
132132
toType = literal.typeOrThrow.asInstanceOf2(
133-
typeProvider.iterableElement2,
133+
typeProvider.iterableElement,
134134
);
135135
} else if (literal is SetOrMapLiteral) {
136136
toType =
137137
literal.typeOrThrow.isDartCoreSet
138138
? literal.typeOrThrow.asInstanceOf2(
139-
typeProvider.iterableElement2,
139+
typeProvider.iterableElement,
140140
)
141-
: literal.typeOrThrow.asInstanceOf2(typeProvider.mapElement2);
141+
: literal.typeOrThrow.asInstanceOf2(typeProvider.mapElement);
142142
}
143143
} else if (parent is YieldStatement) {
144144
var enclosingExecutable =

pkg/analysis_server/lib/src/services/correction/dart/add_return_type.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,18 @@ class AddReturnType extends ResolvedCorrectionProducer {
9999

100100
if (body.isAsynchronous) {
101101
if (body.isGenerator) {
102-
return typeProvider.streamElement2.instantiate(
102+
return typeProvider.streamElement.instantiate(
103103
typeArguments: [baseType],
104104
nullabilitySuffix: baseType.nullabilitySuffix,
105105
);
106106
} else {
107-
return typeProvider.futureElement2.instantiate(
107+
return typeProvider.futureElement.instantiate(
108108
typeArguments: [baseType],
109109
nullabilitySuffix: baseType.nullabilitySuffix,
110110
);
111111
}
112112
} else if (body.isGenerator) {
113-
return typeProvider.iterableElement2.instantiate(
113+
return typeProvider.iterableElement.instantiate(
114114
typeArguments: [baseType],
115115
nullabilitySuffix: baseType.nullabilitySuffix,
116116
);

pkg/analysis_server/lib/src/services/correction/dart/convert_into_for_index.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ConvertIntoForIndex extends ResolvedCorrectionProducer {
6060
{
6161
var iterableType = iterable.staticType;
6262
if (iterableType is! InterfaceType ||
63-
iterableType.element != typeProvider.listElement2) {
63+
iterableType.element != typeProvider.listElement) {
6464
return;
6565
}
6666
}

pkg/analysis_server/lib/src/services/correction/dart/convert_map_from_iterable_to_for_literal.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ConvertMapFromIterableToForLiteral extends ResolvedCorrectionProducer {
4242
var element = creation.constructorName.element;
4343
if (element == null ||
4444
element.name3 != 'fromIterable' ||
45-
element.enclosingElement != typeProvider.mapElement2) {
45+
element.enclosingElement != typeProvider.mapElement) {
4646
return;
4747
}
4848
//

pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ConvertToMapLiteral extends ResolvedCorrectionProducer {
8484
/// Return `true` if the [element] represents either the class `Map` or
8585
/// `LinkedHashMap`.
8686
bool _isMapClass(InterfaceElement element) =>
87-
element == typeProvider.mapElement2 ||
87+
element == typeProvider.mapElement ||
8888
(element.name3 == 'LinkedHashMap' &&
8989
element.library.name3 == 'dart.collection');
9090
}

pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class ConvertToSetLiteral extends ResolvedCorrectionProducer {
147147
}
148148

149149
// TODO(brianwilkerson): Consider also accepting uses of LinkedHashSet.
150-
if (type.element != typeProvider.setElement2) {
150+
if (type.element != typeProvider.setElement) {
151151
return null;
152152
}
153153
return creation;
@@ -199,14 +199,14 @@ class ConvertToSetLiteral extends ResolvedCorrectionProducer {
199199
var parent2 = parent.parent;
200200
if (parent2 is VariableDeclarationList) {
201201
var type = parent2.type?.type;
202-
if (type is InterfaceType && type.element == typeProvider.setElement2) {
202+
if (type is InterfaceType && type.element == typeProvider.setElement) {
203203
return true;
204204
}
205205
}
206206
} else if (parent.parent is InvocationExpression) {
207207
var parameterElement = creation.correspondingParameter;
208208
var type = parameterElement?.type;
209-
if (type is InterfaceType && type.element == typeProvider.setElement2) {
209+
if (type is InterfaceType && type.element == typeProvider.setElement) {
210210
return true;
211211
}
212212
}

pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class ReplaceWithVar extends ResolvedCorrectionProducer {
161161
}
162162
var iterableType = parent.iterable.typeOrThrow;
163163
var instantiatedType = iterableType.asInstanceOf2(
164-
typeProvider.iterableElement2,
164+
typeProvider.iterableElement,
165165
);
166166
if (instantiatedType?.typeArguments.first == staticType) {
167167
return true;

pkg/analysis_server/lib/src/services/refactoring/legacy/extract_method.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ final class ExtractMethodRefactoringImpl extends RefactoringImpl
10341034
_variableType = _getTypeCode(returnTypeObj);
10351035
if (_hasAwait) {
10361036
if (returnTypeObj is InterfaceType &&
1037-
returnTypeObj.element != typeProvider.futureElement2) {
1037+
returnTypeObj.element != typeProvider.futureElement) {
10381038
returnType = _getTypeCode(typeProvider.futureType(returnTypeObj));
10391039
}
10401040
} else {

pkg/analysis_server/tool/code_completion/relevance_metrics.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2072,11 +2072,11 @@ class RelevanceDataCollector extends RecursiveAstVisitor<void> {
20722072
argumentType is InterfaceType &&
20732073
parameterType is InterfaceType) {
20742074
int distance;
2075-
if (parameterType.element == typeProvider.futureOrElement2) {
2075+
if (parameterType.element == typeProvider.futureOrElement) {
20762076
var typeArgument = parameterType.typeArguments[0];
20772077
distance = featureComputer.inheritanceDistance(
20782078
argumentType.element,
2079-
typeProvider.futureElement2,
2079+
typeProvider.futureElement,
20802080
);
20812081
if (typeArgument is InterfaceType) {
20822082
var argDistance = featureComputer.inheritanceDistance(

0 commit comments

Comments
 (0)