File tree Expand file tree Collapse file tree 1 file changed +3
-20
lines changed
Sources/SwiftFormatPrettyPrint Expand file tree Collapse file tree 1 file changed +3
-20
lines changed Original file line number Diff line number Diff line change @@ -3511,33 +3511,16 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
3511
3511
}
3512
3512
3513
3513
private func isNestedInPostfixIfConfig( node: MemberAccessExprSyntax ) -> Bool {
3514
- func containsDescendent( ancestor: Syntax , node: MemberAccessExprSyntax ) -> Bool {
3515
- if ancestor. children ( viewMode: . sourceAccurate) . contains ( Syntax ( node) ) {
3516
- return true
3517
- }
3518
-
3519
- for child in ancestor. children ( viewMode: . sourceAccurate) {
3520
- if containsDescendent ( ancestor: child, node: node) {
3521
- return true
3522
- }
3523
- }
3524
-
3525
- return false
3526
- }
3527
-
3528
3514
var this : Syntax ? = Syntax ( node)
3529
3515
3530
3516
while this? . parent != nil {
3531
3517
if this? . is ( TupleExprElementSyntax . self) == true {
3532
3518
return false
3533
3519
}
3534
3520
3535
- if let postfixIfConfig = this? . as ( PostfixIfConfigExprSyntax . self) {
3536
- if let ifConfigListSyntax = postfixIfConfig. config. children ( viewMode: . sourceAccurate) . first? . as ( IfConfigClauseListSyntax . self) {
3537
- if containsDescendent ( ancestor: Syntax ( ifConfigListSyntax) , node: node) {
3538
- return true
3539
- }
3540
- }
3521
+ if this? . is ( IfConfigDeclSyntax . self) == true &&
3522
+ this? . parent? . is ( PostfixIfConfigExprSyntax . self) == true {
3523
+ return true
3541
3524
}
3542
3525
3543
3526
this = this? . parent
You can’t perform that action at this time.
0 commit comments