Skip to content

Commit 94c7429

Browse files
authored
Merge pull request swiftlang#453 from DougGregor/remove-macro-special-cases
2 parents 7e8bd26 + a26a284 commit 94c7429

File tree

2 files changed

+8
-58
lines changed

2 files changed

+8
-58
lines changed

Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift

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

1212-
override func visit(_ node: ObjcKeyPathExprSyntax) -> SyntaxVisitorContinueKind {
1213-
return .visitChildren
1214-
}
1215-
1216-
override func visit(_ node: ObjectLiteralExprSyntax) -> SyntaxVisitorContinueKind {
1217-
// TODO: Remove this; it has been subsumed by `MacroExpansionDeclSyntax`. But that feature is
1218-
// still in flux and this node type is still present in the API, even though nothing in the
1219-
// parser currently creates it.
1220-
arrangeFunctionCallArgumentList(
1221-
node.arguments,
1222-
leftDelimiter: node.leftParen,
1223-
rightDelimiter: node.rightParen,
1224-
forcesBreakBeforeRightDelimiter: false)
1225-
return .visitChildren
1226-
}
1227-
12281212
override func visit(_ node: MacroExpansionDeclSyntax) -> SyntaxVisitorContinueKind {
12291213
arrangeFunctionCallArgumentList(
12301214
node.argumentList,
@@ -1408,12 +1392,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
14081392
return .visitChildren
14091393
}
14101394

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-
14171395
override func visit(_ node: ObjCSelectorSyntax) -> SyntaxVisitorContinueKind {
14181396
insertTokens(.break(.same, size: 0), betweenElementsOf: node)
14191397
return .visitChildren
@@ -2005,18 +1983,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
20051983
return .visitChildren
20061984
}
20071985

2008-
override func visit(_ node: ObjcNamePieceSyntax) -> SyntaxVisitorContinueKind {
2009-
return .visitChildren
2010-
}
2011-
2012-
override func visit(_ node: PoundFileExprSyntax) -> SyntaxVisitorContinueKind {
2013-
return .visitChildren
2014-
}
2015-
2016-
override func visit(_ node: PoundLineExprSyntax) -> SyntaxVisitorContinueKind {
2017-
return .visitChildren
2018-
}
2019-
20201986
override func visit(_ node: TypealiasDeclSyntax) -> SyntaxVisitorContinueKind {
20211987
arrangeAttributeList(node.attributes)
20221988

@@ -2055,10 +2021,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
20552021
return .visitChildren
20562022
}
20572023

2058-
override func visit(_ node: PoundErrorDeclSyntax) -> SyntaxVisitorContinueKind {
2059-
return .visitChildren
2060-
}
2061-
20622024
override func visit(_ node: SpecializeExprSyntax) -> SyntaxVisitorContinueKind {
20632025
return .visitChildren
20642026
}
@@ -2108,10 +2070,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
21082070
return .visitChildren
21092071
}
21102072

2111-
override func visit(_ node: PoundColumnExprSyntax) -> SyntaxVisitorContinueKind {
2112-
return .visitChildren
2113-
}
2114-
21152073
override func visit(_ node: WildcardPatternSyntax) -> SyntaxVisitorContinueKind {
21162074
return .visitChildren
21172075
}
@@ -2145,10 +2103,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
21452103
return .visitChildren
21462104
}
21472105

2148-
override func visit(_ node: PoundWarningDeclSyntax) -> SyntaxVisitorContinueKind {
2149-
return .visitChildren
2150-
}
2151-
21522106
override func visit(_ node: ExpressionPatternSyntax) -> SyntaxVisitorContinueKind {
21532107
return .visitChildren
21542108
}
@@ -2173,10 +2127,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
21732127
return .visitChildren
21742128
}
21752129

2176-
override func visit(_ node: PoundFunctionExprSyntax) -> SyntaxVisitorContinueKind {
2177-
return .visitChildren
2178-
}
2179-
21802130
override func visit(_ node: StringLiteralExprSyntax) -> SyntaxVisitorContinueKind {
21812131
if node.openQuote.tokenKind == .multilineStringQuote {
21822132
// If it's a multiline string, the last segment of the literal will end with a newline and
@@ -2242,10 +2192,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
22422192
return .visitChildren
22432193
}
22442194

2245-
override func visit(_ node: PoundDsohandleExprSyntax) -> SyntaxVisitorContinueKind {
2246-
return .visitChildren
2247-
}
2248-
22492195
override func visit(_ node: AccessPathComponentSyntax) -> SyntaxVisitorContinueKind {
22502196
return .visitChildren
22512197
}

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)