File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 13
13
import SwiftSyntax
14
14
15
15
extension WithAttributesSyntax {
16
- /// Indicates whether the node has attribute with the given `name`.
16
+ /// Indicates whether the node has attribute with the given `name` and `module`.
17
+ /// The `module` is only considered if the attribute is written as `@Module.Attribute`.
17
18
///
18
19
/// - Parameter name: The name of the attribute to lookup.
19
20
/// - Parameter module: The module name to lookup the attribute in.
@@ -22,10 +23,11 @@ extension WithAttributesSyntax {
22
23
attributes. contains { attribute in
23
24
let attributeName = attribute. as ( AttributeSyntax . self) ? . attributeName
24
25
if let identifier = attributeName? . as ( IdentifierTypeSyntax . self) {
26
+ // @Attribute syntax
25
27
return identifier. name. text == name
26
28
}
27
- // support @Module.Attribute syntax as well
28
29
if let memberType = attributeName? . as ( MemberTypeSyntax . self) {
30
+ // @Module.Attribute syntax
29
31
return memberType. name. text == name
30
32
&& memberType. baseType. as ( IdentifierTypeSyntax . self) ? . name. text == module
31
33
}
You can’t perform that action at this time.
0 commit comments