File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Sources/SwiftSyntaxMacroExpansion
Tests/SwiftSyntaxMacroExpansionTest Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -390,7 +390,11 @@ public class AttributeRemover: SyntaxRewriter {
390
390
391
391
var triviaToAttachToNextToken : Trivia = Trivia ( )
392
392
393
- public init ( where predicate: @escaping ( AttributeSyntax ) -> Bool ) {
393
+ /// Initializes an attribute remover with a given predicate to determine which attributes to remove.
394
+ ///
395
+ /// - Parameter predicate: A closure that determines whether a given `AttributeSyntax` should be removed.
396
+ /// If this closure returns `true` for an attribute, that attribute will be removed.
397
+ public init ( removingWhere predicate: @escaping ( AttributeSyntax ) -> Bool ) {
394
398
self . predicate = predicate
395
399
}
396
400
@@ -574,7 +578,7 @@ private class MacroApplication<Context: MacroExpansionContext>: SyntaxRewriter {
574
578
575
579
let attributesToRemove = self . macroAttributes ( attachedTo: visitedNode) . map ( \. attributeNode)
576
580
577
- return AttributeRemover ( where : { attributesToRemove. contains ( $0) } ) . rewrite ( visitedNode)
581
+ return AttributeRemover ( removingWhere : { attributesToRemove. contains ( $0) } ) . rewrite ( visitedNode)
578
582
}
579
583
580
584
return nil
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ fileprivate func assertSyntaxRemovingTestAttributes(
25
25
let attributeToRemove = AttributeSyntax ( stringLiteral: " @Test " )
26
26
27
27
let reducedSource = AttributeRemover (
28
- where : { $0. trimmedDescription == attributeToRemove. trimmedDescription }
28
+ removingWhere : { $0. trimmedDescription == attributeToRemove. trimmedDescription }
29
29
)
30
30
. rewrite (
31
31
Parser . parse ( source: originalSource)
You can’t perform that action at this time.
0 commit comments