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 {
390390
391391 var triviaToAttachToNextToken : Trivia = Trivia ( )
392392
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 ) {
394398 self . predicate = predicate
395399 }
396400
@@ -574,7 +578,7 @@ private class MacroApplication<Context: MacroExpansionContext>: SyntaxRewriter {
574578
575579 let attributesToRemove = self . macroAttributes ( attachedTo: visitedNode) . map ( \. attributeNode)
576580
577- return AttributeRemover ( where : { attributesToRemove. contains ( $0) } ) . rewrite ( visitedNode)
581+ return AttributeRemover ( removingWhere : { attributesToRemove. contains ( $0) } ) . rewrite ( visitedNode)
578582 }
579583
580584 return nil
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ fileprivate func assertSyntaxRemovingTestAttributes(
2525 let attributeToRemove = AttributeSyntax ( stringLiteral: " @Test " )
2626
2727 let reducedSource = AttributeRemover (
28- where : { $0. trimmedDescription == attributeToRemove. trimmedDescription }
28+ removingWhere : { $0. trimmedDescription == attributeToRemove. trimmedDescription }
2929 )
3030 . rewrite (
3131 Parser . parse ( source: originalSource)
You can’t perform that action at this time.
0 commit comments