Skip to content

Commit 7505e45

Browse files
scheglovCommit Queue
authored andcommitted
Elements. Remove 'get identifier' from ElementImpl and FragmentImpl.
We used it to construct `ElementLocation`, and we already removed it. Change-Id: Ie88ba3aae24f094c6eb2c5b656cc64398e5ba91b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/437360 Reviewed-by: Paul Berry <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent c98b675 commit 7505e45

File tree

2 files changed

+2
-47
lines changed

2 files changed

+2
-47
lines changed

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

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import 'dart:collection';
66

7-
import 'package:_fe_analyzer_shared/src/scanner/string_canonicalizer.dart';
87
import 'package:_fe_analyzer_shared/src/type_inference/type_analyzer.dart'
98
as shared;
109
import 'package:_fe_analyzer_shared/src/type_inference/type_analyzer_operations.dart'
@@ -2043,17 +2042,6 @@ abstract class ElementImpl implements Element {
20432042
];
20442043
}
20452044

2046-
/// Return an identifier that uniquely identifies this element among the
2047-
/// children of this element's parent.
2048-
String get identifier {
2049-
var identifier = name3!;
2050-
// TODO(augmentations): Figure out how to get a unique identifier. In the
2051-
// old model we sometimes used the offset of the name to disambiguate
2052-
// between elements, but we can't do that anymore because the name can
2053-
// appear at multiple offsets.
2054-
return considerCanonicalizeString(identifier);
2055-
}
2056-
20572045
@override
20582046
bool get isPrivate {
20592047
var name3 = this.name3;
@@ -3884,18 +3872,6 @@ abstract class FragmentImpl implements FragmentOrMember {
38843872
return enclosingElement3!.enclosingUnit;
38853873
}
38863874

3887-
/// Return an identifier that uniquely identifies this element among the
3888-
/// children of this element's parent.
3889-
String get identifier {
3890-
var identifier = name2 ?? '';
3891-
3892-
if (_includeNameOffsetInIdentifier) {
3893-
identifier += "@$nameOffset";
3894-
}
3895-
3896-
return considerCanonicalizeString(identifier);
3897-
}
3898-
38993875
bool get isNonFunctionTypeAliasesEnabled {
39003876
return library!.featureSet.isEnabled(Feature.nonfunction_type_aliases);
39013877
}
@@ -4343,9 +4319,6 @@ class GenericFunctionTypeFragmentImpl extends _ExistingFragmentImpl
43434319
@override
43444320
List<FormalParameterFragmentImpl> get formalParameters => parameters;
43454321

4346-
@override
4347-
String get identifier => '-';
4348-
43494322
@override
43504323
ElementKind get kind => ElementKind.GENERIC_FUNCTION_TYPE;
43514324

@@ -4625,9 +4598,6 @@ abstract class InstanceElementImpl extends ElementImpl
46254598
@override
46264599
List<GetterElementImpl> get getters2 => getters;
46274600

4628-
@override
4629-
String get identifier => name3 ?? firstFragment.identifier;
4630-
46314601
@override
46324602
bool get isPrivate => firstFragment.isPrivate;
46334603

@@ -6123,7 +6093,7 @@ class LibraryElementImpl extends ElementImpl
61236093
}
61246094

61256095
@override
6126-
String get identifier => '${definingCompilationUnit.source.uri}';
6096+
String get identifier => '$uri';
61276097

61286098
@override
61296099
bool get isDartAsync => name == "dart.async";
@@ -6652,9 +6622,6 @@ class LibraryFragmentImpl extends _ExistingFragmentImpl
66526622
@override
66536623
int get hashCode => source.hashCode;
66546624

6655-
@override
6656-
String get identifier => '${source.uri}';
6657-
66586625
@override
66596626
List<LibraryElement> get importedLibraries2 {
66606627
return libraryImports2
@@ -7286,11 +7253,6 @@ class LocalVariableFragmentImpl extends NonParameterVariableFragmentImpl
72867253
enclosingElement3 = value as FragmentImpl;
72877254
}
72887255

7289-
@override
7290-
String get identifier {
7291-
return '$name2$nameOffset';
7292-
}
7293-
72947256
@override
72957257
bool get isLate {
72967258
return hasModifier(Modifier.LATE);
@@ -8964,13 +8926,6 @@ sealed class PropertyAccessorFragmentImpl extends ExecutableFragmentImpl
89648926
throw UnsupportedError('Not a fragment: ${enclosing.runtimeType}');
89658927
}
89668928

8967-
@override
8968-
String get identifier {
8969-
String name = displayName;
8970-
String suffix = isGetter ? "?" : "=";
8971-
return considerCanonicalizeString("$name$suffix");
8972-
}
8973-
89748929
/// Set whether this class is abstract.
89758930
set isAbstract(bool isAbstract) {
89768931
setModifier(Modifier.ABSTRACT, isAbstract);

pkg/analyzer/lib/src/error/dead_code_verifier.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class DeadCodeVerifier extends RecursiveAstVisitor<void> {
158158
_diagnosticReporter.atNode(
159159
name,
160160
warningCode,
161-
arguments: [library.identifier, nameStr],
161+
arguments: ['${library.uri}', nameStr],
162162
);
163163
}
164164
}

0 commit comments

Comments
 (0)