Skip to content

Commit 025bed9

Browse files
committed
Handle removal of special syntax nodes for #selector and #keyPath.
1 parent 7e8bd26 commit 025bed9

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,10 +1209,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
12091209
return .skipChildren
12101210
}
12111211

1212-
override func visit(_ node: ObjcKeyPathExprSyntax) -> SyntaxVisitorContinueKind {
1213-
return .visitChildren
1214-
}
1215-
12161212
override func visit(_ node: ObjectLiteralExprSyntax) -> SyntaxVisitorContinueKind {
12171213
// TODO: Remove this; it has been subsumed by `MacroExpansionDeclSyntax`. But that feature is
12181214
// still in flux and this node type is still present in the API, even though nothing in the
@@ -1408,12 +1404,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
14081404
return .visitChildren
14091405
}
14101406

1411-
override func visit(_ node: ObjcSelectorExprSyntax) -> SyntaxVisitorContinueKind {
1412-
after(node.leftParen, tokens: .break(.open, size: 0), .open)
1413-
before(node.rightParen, tokens: .break(.close(mustBreak: false), size: 0), .close)
1414-
return .visitChildren
1415-
}
1416-
14171407
override func visit(_ node: ObjCSelectorSyntax) -> SyntaxVisitorContinueKind {
14181408
insertTokens(.break(.same, size: 0), betweenElementsOf: node)
14191409
return .visitChildren
@@ -2005,10 +1995,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
20051995
return .visitChildren
20061996
}
20071997

2008-
override func visit(_ node: ObjcNamePieceSyntax) -> SyntaxVisitorContinueKind {
2009-
return .visitChildren
2010-
}
2011-
20121998
override func visit(_ node: PoundFileExprSyntax) -> SyntaxVisitorContinueKind {
20131999
return .visitChildren
20142000
}

Tests/SwiftFormatPrettyPrintTests/DeclNameArgumentTests.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ final class DeclNameArgumentTests: PrettyPrintTestCase {
1919
thirdArg:
2020
fourthArg:
2121
fifthArg:
22-
))
22+
)
23+
)
2324
let selector = #selector(
24-
FooClass.method(firstArg:secondArg:))
25+
FooClass.method(firstArg:secondArg:)
26+
)
2527
let selector = #selector(
2628
FooClass.VeryDeeply.NestedInner.Member
27-
.foo(firstArg:secondArg:))
29+
.foo(firstArg:secondArg:)
30+
)
2831
let selector = #selector(
2932
FooClass.VeryDeeply.NestedInner.Member
3033
.foo(
@@ -33,7 +36,8 @@ final class DeclNameArgumentTests: PrettyPrintTestCase {
3336
thirdArg:
3437
fourthArg:
3538
fifthArg:
36-
))
39+
)
40+
)
3741
3842
"""
3943

0 commit comments

Comments
 (0)