Skip to content

Commit 14de152

Browse files
fshcheglovCommit Queue
authored andcommitted
Deprecate Fragment.name2, use name instead.
Change-Id: Ic0506f50e9dc752b7e8e28f4299426be47407d4f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/439081 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 2419e97 commit 14de152

File tree

62 files changed

+444
-377
lines changed

Some content is hidden

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

62 files changed

+444
-377
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class DartInlayHintComputer {
217217
}
218218
return Location(
219219
uri: pathContext.toUri(path),
220-
range: toRange(lineInfo, nameOffset, firstFragment.name2?.length ?? 0),
220+
range: toRange(lineInfo, nameOffset, firstFragment.name?.length ?? 0),
221221
);
222222
}
223223

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class TypeHierarchyItem {
234234
assert(fragment.nameOffset2 != -1);
235235
return fragment.nameOffset2 == -1
236236
? SourceRange(0, 0)
237-
: SourceRange(fragment.nameOffset2 ?? 0, fragment.name2?.length ?? 0);
237+
: SourceRange(fragment.nameOffset2 ?? 0, fragment.name?.length ?? 0);
238238
}
239239
}
240240

pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ImplementedComputer {
3535
void _addImplementedClass(InterfaceElement element) {
3636
for (var fragment in element.fragments) {
3737
var offset = fragment.nameOffset2;
38-
var name = fragment.name2;
38+
var name = fragment.name;
3939
if (offset != null && name != null) {
4040
classes.add(protocol.ImplementedClass(offset, name.length));
4141
}
@@ -45,7 +45,7 @@ class ImplementedComputer {
4545
void _addImplementedMember(Element element) {
4646
for (var fragment in element.fragments) {
4747
var offset = fragment.nameOffset2;
48-
var name = fragment.name2;
48+
var name = fragment.name;
4949
if (offset != null && name != null) {
5050
members.add(protocol.ImplementedMember(offset, name.length));
5151
}

pkg/analysis_server/lib/src/lsp/handlers/handler_implementation.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class ImplementationHandler
107107
}
108108

109109
var nameOffset = firstFragment.nameOffset2;
110-
var name = firstFragment.name2;
110+
var name = firstFragment.name;
111111
if (nameOffset == null || name == null) {
112112
return null;
113113
}

pkg/analysis_server/lib/src/lsp/handlers/handler_type_definition.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class TypeDefinitionHandler
123123
}
124124

125125
var nameOffset = targetFragment.nameOffset2;
126-
var nameLength = targetFragment.name2?.length;
126+
var nameLength = targetFragment.name?.length;
127127
if (nameOffset == null || nameLength == null) {
128128
return success(_emptyResult);
129129
}

pkg/analysis_server/lib/src/lsp/mapping.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,10 @@ lsp.Location? fragmentToLocation(
534534
) when isSynthetic) {
535535
var element = fragment.element.nonSynthetic;
536536
nameOffset = element.firstFragment.nameOffset2;
537-
nameLength = element.firstFragment.name2?.length;
537+
nameLength = element.firstFragment.name?.length;
538538
} else {
539539
nameOffset = fragment.nameOffset2;
540-
nameLength = fragment.name2?.length;
540+
nameLength = fragment.name?.length;
541541
}
542542

543543
// For unnamed constructors, use the type name as the target location.

pkg/analysis_server/lib/src/protocol_server.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ Location? newLocation_fromElement(engine.Element? element) {
267267
// instead of using 0,0.
268268
engine.ConstructorFragment(:var typeNameOffset, :var typeName) =>
269269
fragment.nameOffset2 != null
270-
? (fragment.nameOffset2 ?? 0, fragment.name2.length)
270+
? (fragment.nameOffset2 ?? 0, fragment.name.length)
271271
: (typeNameOffset ?? 0, typeName?.length ?? 0),
272-
_ => (fragment.nameOffset2 ?? 0, fragment.name2?.length ?? 0),
272+
_ => (fragment.nameOffset2 ?? 0, fragment.name?.length ?? 0),
273273
};
274274
var range = engine.SourceRange(offset, length);
275275
return _locationForArgs2(fragment, range);
@@ -285,7 +285,7 @@ Location? newLocation_fromFragment(engine.Fragment? fragment) {
285285
return null;
286286
}
287287
var offset = fragment.nameOffset2 ?? 0;
288-
var length = fragment.name2?.length ?? 0;
288+
var length = fragment.name?.length ?? 0;
289289
var range = engine.SourceRange(offset, length);
290290
return _locationForArgs2(fragment, range);
291291
}

pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class SuggestionBuilder {
177177
var enclosingClass = constructor.enclosingElement.firstFragment;
178178

179179
if (completion == null) {
180-
var className = enclosingClass.name2;
180+
var className = enclosingClass.name;
181181
if (className == null || className.isEmpty) {
182182
return;
183183
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ReplaceReturnType extends ResolvedCorrectionProducer {
9999
return false;
100100
}
101101

102-
var methodName = method.declaredFragment!.name2;
102+
var methodName = method.declaredFragment!.name;
103103
if (methodName == null) {
104104
return false;
105105
}

pkg/analysis_server/lib/src/services/correction/fix/data_driven/rename_parameter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ extension on MethodDeclaration {
150150
var parameters = this.parameters;
151151
if (parameters != null) {
152152
for (var parameter in parameters.parameters) {
153-
if (parameter.declaredFragment?.name2 == name) {
153+
if (parameter.declaredFragment?.name == name) {
154154
return parameter;
155155
}
156156
}

0 commit comments

Comments
 (0)