Skip to content

Commit 3af9430

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Separate Element2.name from Element.name by renaming to 'name3'.
They were intersecting at ElementImpl and Member(s). This will unblock updating implementations to make them nullable. Change-Id: Ic9907eaa0ef08c096839f212668fa1e3d92bbf3d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/391540 Reviewed-by: Samuel Rawlins <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 6b80ece commit 3af9430

File tree

76 files changed

+214
-199
lines changed

Some content is hidden

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

76 files changed

+214
-199
lines changed

pkg/analysis_server/lib/src/computer/computer_color.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ColorComputer {
7575
var constructor = expression.constructorName;
7676
var staticElement = constructor.element;
7777
var classElement = staticElement?.enclosingElement2;
78-
var className = classElement?.name;
78+
var className = classElement?.name3;
7979
var constructorName = constructor.name?.name;
8080
var constructorArgs = expression.argumentList.arguments.toList();
8181

@@ -219,7 +219,7 @@ class ColorComputer {
219219
}
220220

221221
/// Checks whether this elements library is dart:ui.
222-
bool _isDartUi(Element2? element) => element?.library2?.name == 'dart.ui';
222+
bool _isDartUi(Element2? element) => element?.library2?.name3 == 'dart.ui';
223223

224224
/// Checks whether this elements library is Flutter Material colors.
225225
bool _isFlutterMaterial(Element2? element) =>

pkg/analysis_server/lib/src/computer/computer_outline.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ class _FunctionBodyOutlinesVisitor extends RecursiveAstVisitor<void> {
465465
return true;
466466
}
467467
return element is engine.TopLevelFunctionElement &&
468-
element.name == 'group' &&
468+
element.name3 == 'group' &&
469469
_isInsideTestPackage(element);
470470
}
471471

@@ -476,7 +476,7 @@ class _FunctionBodyOutlinesVisitor extends RecursiveAstVisitor<void> {
476476
return true;
477477
}
478478
return element is engine.TopLevelFunctionElement &&
479-
element.name == 'test' &&
479+
element.name3 == 'test' &&
480480
_isInsideTestPackage(element);
481481
}
482482

pkg/analysis_server/lib/src/protocol_server.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,19 +277,19 @@ Location? newLocation_fromElement2(engine.Element2? element) {
277277
return _locationForArgs2(fragment, range);
278278
} else if (element is engine.LocalFunctionElement) {
279279
var offset = element.nameOffset;
280-
var length = element.name?.length ?? 0;
280+
var length = element.name3?.length ?? 0;
281281
var range = engine.SourceRange(offset, length);
282282
var fragment = element.enclosingFunction;
283283
return _locationForArgs2(fragment, range);
284284
} else if (element is engine.LocalVariableElement2) {
285285
var offset = element.nameOffset;
286-
var length = element.name?.length ?? 0;
286+
var length = element.name3?.length ?? 0;
287287
var range = engine.SourceRange(offset, length);
288288
var fragment = element.enclosingFunction;
289289
return _locationForArgs2(fragment, range);
290290
} else if (element is engine.LabelElement2) {
291291
var offset = element.nameOffset;
292-
var length = element.name.length;
292+
var length = element.name3.length;
293293
var range = engine.SourceRange(offset, length);
294294
var fragment = element.enclosingFunction;
295295
return _locationForArgs2(fragment, range);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class AddCallSuper extends ResolvedCorrectionProducer {
4141
var nameObj = Name.forLibrary(classElement.library2, name);
4242
var overridden = InheritanceManager3().getInherited4(classElement, nameObj);
4343
if (overridden == null) return;
44-
var overriddenParameters = overridden.formalParameters.map((p) => p.name);
44+
var overriddenParameters = overridden.formalParameters.map((p) => p.name3);
4545

4646
var body = methodDeclaration.body;
4747
var parameters = methodDeclaration.parameters?.parameters;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class AddFieldFormalParameters extends ResolvedCorrectionProducer {
5656
if (typeSystem.isPotentiallyNonNullable(field.type)) {
5757
prefix = 'required ';
5858
}
59-
return '${prefix}this.${field.name}';
59+
return '${prefix}this.${field.name3}';
6060
}
6161

6262
var fieldParametersCode = fields.map(parameterForField).join(', ');
@@ -79,7 +79,7 @@ class AddFieldFormalParameters extends ResolvedCorrectionProducer {
7979
}
8080

8181
var fieldParametersCode =
82-
fields.map((field) => 'this.${field.name}').join(', ');
82+
fields.map((field) => 'this.${field.name3}').join(', ');
8383
await builder.addDartFileEdit(file, (builder) {
8484
if (lastRequiredParameter != null) {
8585
builder.addSimpleInsertion(

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ class AddMissingEnumCaseClauses extends ResolvedCorrectionProducer {
4646
if (expressionType is InterfaceType) {
4747
var enumElement = expressionType.element3;
4848
if (enumElement is EnumElement2) {
49-
enumName = enumElement.name;
49+
enumName = enumElement.name3;
5050
for (var field in enumElement.fields2) {
5151
if (field.isEnumConstant) {
52-
unhandledEnumCases.addIfNotNull(field.name);
52+
unhandledEnumCases.addIfNotNull(field.name3);
5353
}
5454
}
5555
prefix = _importPrefix(enumElement);
@@ -68,7 +68,7 @@ class AddMissingEnumCaseClauses extends ResolvedCorrectionProducer {
6868
if (expression is Identifier) {
6969
var element = expression.element;
7070
if (element is GetterElement) {
71-
unhandledEnumCases.remove(element.name);
71+
unhandledEnumCases.remove(element.name3);
7272
}
7373
} else if (expression is NullLiteral) {
7474
unhandledNullValue = false;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class AddMissingEnumLikeCaseClauses extends ResolvedCorrectionProducer {
3535
return;
3636
}
3737
var classElement = expressionType.element3;
38-
var className = classElement.name;
38+
var className = classElement.name3;
3939
if (className == null) {
4040
return;
4141
}
@@ -88,7 +88,7 @@ class AddMissingEnumLikeCaseClauses extends ResolvedCorrectionProducer {
8888
if (expression is Identifier) {
8989
var element = expression.element;
9090
if (element is GetterElement) {
91-
caseNames.addIfNotNull(element.name);
91+
caseNames.addIfNotNull(element.name3);
9292
}
9393
} else if (expression is PropertyAccess) {
9494
caseNames.add(expression.propertyName.name);
@@ -111,7 +111,7 @@ class AddMissingEnumLikeCaseClauses extends ResolvedCorrectionProducer {
111111
if (field.type != type) {
112112
continue;
113113
}
114-
constantNames.addIfNotNull(field.name);
114+
constantNames.addIfNotNull(field.name3);
115115
}
116116
return constantNames;
117117
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class AddMissingRequiredArgument extends ResolvedCorrectionProducer {
6767
_missingParameterName = messageParts[1];
6868

6969
var missingParameter = targetElement.formalParameters.firstWhereOrNull(
70-
(p) => p.name == _missingParameterName,
70+
(p) => p.name3 == _missingParameterName,
7171
);
7272
if (missingParameter == null) {
7373
return;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class AddMissingSwitchCases extends ResolvedCorrectionProducer {
172172
if (part is MissingPatternEnumValuePart) {
173173
builder.writeReference2(part.enumElement2);
174174
builder.write('.');
175-
builder.write(part.value2.name!);
175+
builder.write(part.value2.name3!);
176176
} else if (part is MissingPatternTextPart) {
177177
builder.write(part.text);
178178
} else if (part is MissingPatternTypePart) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class AddSuperParameter extends ResolvedCorrectionProducer {
5454
var superPositionalParameters = <FormalParameterElement>[];
5555
for (var superParameter in superParameters) {
5656
if (superParameter.isRequired) {
57-
var name = superParameter.name;
57+
var name = superParameter.name3;
5858
if (superParameter.isNamed) {
5959
if (!parameters.any((parameter) => parameter.name?.lexeme == name)) {
6060
missingNamedParameters.add(superParameter);
@@ -72,7 +72,7 @@ class AddSuperParameter extends ResolvedCorrectionProducer {
7272
if (parameter.isRequiredPositional) {
7373
if (parameter is! SuperFormalParameter ||
7474
i >= superPositionalParameters.length ||
75-
parameter.name.lexeme != superPositionalParameters[i].name) {
75+
parameter.name.lexeme != superPositionalParameters[i].name3) {
7676
arePositionalOrdered = false;
7777
break;
7878
}

0 commit comments

Comments
 (0)