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 1313import SwiftSyntax
1414
1515extension 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`.
1718 ///
1819 /// - Parameter name: The name of the attribute to lookup.
1920 /// - Parameter module: The module name to lookup the attribute in.
@@ -22,10 +23,11 @@ extension WithAttributesSyntax {
2223 attributes. contains { attribute in
2324 let attributeName = attribute. as ( AttributeSyntax . self) ? . attributeName
2425 if let identifier = attributeName? . as ( IdentifierTypeSyntax . self) {
26+ // @Attribute syntax
2527 return identifier. name. text == name
2628 }
27- // support @Module.Attribute syntax as well
2829 if let memberType = attributeName? . as ( MemberTypeSyntax . self) {
30+ // @Module.Attribute syntax
2931 return memberType. name. text == name
3032 && memberType. baseType. as ( IdentifierTypeSyntax . self) ? . name. text == module
3133 }
You can’t perform that action at this time.
0 commit comments