Skip to content

Commit 676e668

Browse files
committed
reverted changes
1 parent e1cea6f commit 676e668

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

Sources/SwiftSyntaxMacroExpansion/MacroSystem.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ public class AttributeRemover: SyntaxRewriter {
398398
self.predicate = predicate
399399
}
400400

401-
public override func visitAttributeListSyntax(_ node: AttributeListSyntax) -> AttributeListSyntax {
401+
public override func visit(_ node: AttributeListSyntax) -> AttributeListSyntax {
402402
var filteredAttributes: [AttributeListSyntax.Element] = []
403403
for case .attribute(let attribute) in node {
404404
if self.predicate(attribute) {
@@ -584,7 +584,7 @@ private class MacroApplication<Context: MacroExpansionContext>: SyntaxRewriter {
584584
return nil
585585
}
586586

587-
override func visitCodeBlockItemListSyntax(_ node: CodeBlockItemListSyntax) -> CodeBlockItemListSyntax {
587+
override func visit(_ node: CodeBlockItemListSyntax) -> CodeBlockItemListSyntax {
588588
var newItems: [CodeBlockItemSyntax] = []
589589
func addResult(_ node: CodeBlockItemSyntax) {
590590
// Expand freestanding macro.
@@ -600,7 +600,7 @@ private class MacroApplication<Context: MacroExpansionContext>: SyntaxRewriter {
600600
newItems.append(node)
601601
case .notAMacro:
602602
// Recurse on the child node
603-
newItems.append(visitCodeBlockItemSyntax(node))
603+
newItems.append(visit(node))
604604
}
605605

606606
// Expand any peer macro on this item.
@@ -625,7 +625,7 @@ private class MacroApplication<Context: MacroExpansionContext>: SyntaxRewriter {
625625
return CodeBlockItemListSyntax(newItems)
626626
}
627627

628-
override func visitMemberBlockItemListSyntax(_ node: MemberBlockItemListSyntax) -> MemberBlockItemListSyntax {
628+
override func visit(_ node: MemberBlockItemListSyntax) -> MemberBlockItemListSyntax {
629629
let parentDeclGroup = node
630630
.parent?
631631
.as(MemberBlockSyntax.self)?
@@ -645,7 +645,7 @@ private class MacroApplication<Context: MacroExpansionContext>: SyntaxRewriter {
645645
newItems.append(node)
646646
case .notAMacro:
647647
// Recurse on the child node.
648-
newItems.append(visitMemberBlockItemSyntax(node))
648+
newItems.append(visit(node))
649649
}
650650

651651
// Expand any peer macro on this member.
@@ -691,8 +691,8 @@ private class MacroApplication<Context: MacroExpansionContext>: SyntaxRewriter {
691691
return .init(newItems)
692692
}
693693

694-
override func visitVariableDeclSyntax(_ node: VariableDeclSyntax) -> DeclSyntax {
695-
var node = super.visitVariableDeclSyntax(node).cast(VariableDeclSyntax.self)
694+
override func visit(_ node: VariableDeclSyntax) -> DeclSyntax {
695+
var node = super.visit(node).cast(VariableDeclSyntax.self)
696696

697697
guard !macroAttributes(attachedTo: DeclSyntax(node), ofType: AccessorMacro.Type.self).isEmpty else {
698698
return DeclSyntax(node)
@@ -706,8 +706,8 @@ private class MacroApplication<Context: MacroExpansionContext>: SyntaxRewriter {
706706
return DeclSyntax(node)
707707
}
708708

709-
override func visitSubscriptDeclSyntax(_ node: SubscriptDeclSyntax) -> DeclSyntax {
710-
var node = super.visitSubscriptDeclSyntax(node).cast(SubscriptDeclSyntax.self)
709+
override func visit(_ node: SubscriptDeclSyntax) -> DeclSyntax {
710+
var node = super.visit(node).cast(SubscriptDeclSyntax.self)
711711
node.accessorBlock = expandAccessors(of: node, existingAccessors: node.accessorBlock)
712712
return DeclSyntax(node)
713713
}

Sources/_SwiftSyntaxTestSupport/SyntaxProtocol+Initializer.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,27 @@ private class InitializerExprFormat: BasicFormat {
3939
return formattedChildren
4040
}
4141

42-
override func visitLabeledExprListSyntax(_ node: LabeledExprListSyntax) -> LabeledExprListSyntax {
42+
override func visit(_ node: LabeledExprListSyntax) -> LabeledExprListSyntax {
4343
let children = node.children(viewMode: .all)
4444
// If the function only takes a single argument, display it on the same line
4545
if let callee = node.parent?.as(FunctionCallExprSyntax.self)?.calledExpression.as(MemberAccessExprSyntax.self), callee.base == nil {
4646
// This is a constructor for tokens. Write them on a single line
47-
return super.visitLabeledExprListSyntax(node)
47+
return super.visit(node)
4848
}
4949
if children.count > 1 {
5050
return LabeledExprListSyntax(formatChildrenSeparatedByNewline(children: children, elementType: LabeledExprSyntax.self))
5151
} else {
52-
return super.visitLabeledExprListSyntax(node)
52+
return super.visit(node)
5353
}
5454
}
5555

56-
override func visitArrayElementListSyntax(_ node: ArrayElementListSyntax) -> ArrayElementListSyntax {
56+
override func visit(_ node: ArrayElementListSyntax) -> ArrayElementListSyntax {
5757
let children = node.children(viewMode: .all)
5858
// Short array literals are presented on one line, list each element on a different line.
5959
if node.description.count > 30 {
6060
return ArrayElementListSyntax(formatChildrenSeparatedByNewline(children: children, elementType: ArrayElementSyntax.self))
6161
} else {
62-
return super.visitArrayElementListSyntax(node)
62+
return super.visit(node)
6363
}
6464
}
6565
}

Tests/SwiftParserTest/Assertions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,19 +680,19 @@ extension ParserTestCase {
680680
/// the closing quote of a multi-line string literals has impact on how much
681681
/// leading trivia is stripped from the literal’s content.
682682
class TriviaRemover: SyntaxRewriter {
683-
override func visitStringLiteralExprSyntax(_ node: StringLiteralExprSyntax) -> ExprSyntax {
683+
override func visit(_ node: StringLiteralExprSyntax) -> ExprSyntax {
684684
if node.openingQuote.tokenKind == .multilineStringQuote {
685685
return ExprSyntax(node)
686686
} else {
687-
return super.visitStringLiteralExprSyntax(node)
687+
return super.visit(node)
688688
}
689689
}
690690

691-
override func visitSimpleStringLiteralExprSyntax(_ node: SimpleStringLiteralExprSyntax) -> ExprSyntax {
691+
override func visit(_ node: SimpleStringLiteralExprSyntax) -> ExprSyntax {
692692
if node.openingQuote.tokenKind == .multilineStringQuote {
693693
return ExprSyntax(node)
694694
} else {
695-
return super.visitSimpleStringLiteralExprSyntax(node)
695+
return super.visit(node)
696696
}
697697
}
698698

Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ final class StringInterpolationTests: XCTestCase {
242242
"""
243243
)
244244
class Rewriter: SyntaxRewriter {
245-
override func visitFunctionDeclSyntax(_ node: FunctionDeclSyntax) -> DeclSyntax {
245+
override func visit(_ node: FunctionDeclSyntax) -> DeclSyntax {
246246
let newFunc = DeclSyntax("func newName() {}")
247247
.with(\.leadingTrivia, node.leadingTrivia)
248248
.with(\.trailingTrivia, node.trailingTrivia)

0 commit comments

Comments
 (0)