@@ -27,16 +27,6 @@ class EnumLikeClassDescription {
2727 Map <DartObject , Set <FieldElement2 >> get enumConstants => {..._enumConstants};
2828}
2929
30- extension on SetterElement {
31- /// Return name in a format suitable for string comparison.
32- String ? get canonicalName {
33- var name = name3;
34- if (name == null ) return null ;
35- // TODO(pq): remove when `name3` consistently does not include a trailing `=`.
36- return name.endsWith ('=' ) ? name.substring (0 , name.length - 1 ) : name;
37- }
38- }
39-
4030extension AstNodeExtension on AstNode {
4131 Iterable <AstNode > get childNodes => childEntities.whereType <AstNode >();
4232
@@ -289,20 +279,7 @@ extension ClassMemberListExtension on List<ClassMember> {
289279 .firstWhereOrNull ((node) => node.name.lexeme == name);
290280}
291281
292- extension ConstructorElementExtension on ConstructorElement {
293- /// Returns whether `this` is the same element as the [className] constructor
294- /// named [constructorName] declared in [uri] .
295- bool isSameAs ({
296- required String uri,
297- required String className,
298- required String constructorName,
299- }) =>
300- library.name == uri &&
301- enclosingElement3.name == className &&
302- name == constructorName;
303- }
304-
305- extension ConstructorElementExtension2 on ConstructorElement2 {
282+ extension ConstructorElementExtension on ConstructorElement2 {
306283 /// Returns whether `this` is the same element as the [className] constructor
307284 /// named [constructorName] declared in [uri] .
308285 bool isSameAs ({
@@ -581,13 +558,6 @@ extension InhertanceManager3Extension on InheritanceManager3 {
581558 }
582559}
583560
584- extension InterfaceElementExtension on InterfaceElement {
585- /// Returns whether this element is exactly [otherName] declared in
586- /// [otherLibrary] .
587- bool isClass (String otherName, String otherLibrary) =>
588- name == otherName && library.name == otherLibrary;
589- }
590-
591561extension InterfaceTypeExtension on InterfaceType {
592562 /// Returns the collection of all interfaces that this type implements,
593563 /// including itself.
@@ -614,8 +584,9 @@ extension InterfaceTypeExtension on InterfaceType {
614584 return interfaceTypes;
615585 }
616586
617- GetterElement ? getGetter2 (String name) =>
618- getters.firstWhereOrNull ((s) => s.name3 == name);
587+ GetterElement ? getGetter2 (String name, {LibraryElement2 ? library}) =>
588+ getters.firstWhereOrNull ((s) =>
589+ s.name3 == name && (library == null || (s.library2 == library)));
619590
620591 SetterElement ? getSetter2 (String name) =>
621592 setters.firstWhereOrNull ((s) => s.canonicalName == name);
@@ -730,6 +701,16 @@ extension MethodDeclarationExtension on MethodDeclaration {
730701 }
731702}
732703
704+ extension SetterElementExtension on SetterElement {
705+ /// Return name in a format suitable for string comparison.
706+ String ? get canonicalName {
707+ var name = name3;
708+ if (name == null ) return null ;
709+ // TODO(pq): remove when `name3` consistently does not include a trailing `=`.
710+ return name.endsWith ('=' ) ? name.substring (0 , name.length - 1 ) : name;
711+ }
712+ }
713+
733714extension StringExtension on String {
734715 String toAbsoluteNormalizedPath () {
735716 var pathContext = PhysicalResourceProvider .INSTANCE .pathContext;
0 commit comments