@@ -62,38 +62,43 @@ Iterable<InheritingContainer> findCanonicalFor(
62
62
c);
63
63
}
64
64
65
- bool hasPrivateName (Element e) {
66
- var elementName = e.name;
67
- if (elementName == null ) return false ;
65
+ extension ElementExtension on Element {
66
+ bool get hasPrivateName {
67
+ final name = this .name;
68
+ if (name == null ) return false ;
68
69
69
- if (elementName.startsWith ('_' )) {
70
- return true ;
71
- }
72
- // GenericFunctionTypeElements have the name we care about in the enclosing
73
- // element.
74
- if (e is GenericFunctionTypeElement ) {
75
- var enclosingElementName = e.enclosingElement? .name;
76
- if (enclosingElementName != null && enclosingElementName.startsWith ('_' )) {
70
+ if (name.startsWith ('_' )) {
77
71
return true ;
78
72
}
79
- }
80
- if (e is LibraryElement ) {
81
- if (e.identifier.startsWith ('dart:_' ) ||
82
- e.identifier.startsWith ('dart:nativewrappers/' ) ||
83
- 'dart:nativewrappers' == e.identifier) {
84
- return true ;
73
+
74
+ var self = this ;
75
+
76
+ // GenericFunctionTypeElements have the name we care about in the enclosing
77
+ // element.
78
+ if (self is GenericFunctionTypeElement ) {
79
+ var enclosingElementName = self.enclosingElement? .name;
80
+ if (enclosingElementName != null &&
81
+ enclosingElementName.startsWith ('_' )) {
82
+ return true ;
83
+ }
85
84
}
86
- var elementUri = e.source.uri;
87
- // TODO(jcollins-g): Implement real cross package detection
88
- if (elementUri.scheme == 'package' && elementUri.pathSegments[1 ] == 'src' ) {
89
- return true ;
85
+ if (self is LibraryElement ) {
86
+ if (self.identifier.startsWith ('dart:_' ) ||
87
+ self.identifier.startsWith ('dart:nativewrappers/' ) ||
88
+ 'dart:nativewrappers' == self.identifier) {
89
+ return true ;
90
+ }
91
+ var elementUri = self.source.uri;
92
+ // TODO(jcollins-g): Implement real cross package detection.
93
+ if (elementUri.scheme == 'package' &&
94
+ elementUri.pathSegments[1 ] == 'src' ) {
95
+ return true ;
96
+ }
90
97
}
98
+ return false ;
91
99
}
92
- return false ;
93
100
}
94
101
95
- bool hasPublicName (Element e) => ! hasPrivateName (e);
96
-
97
102
extension IterableOfDocumentableExtension <E extends Documentable >
98
103
on Iterable <E > {
99
104
/// The public items which are documented.
0 commit comments