@@ -3298,7 +3298,8 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
3298
3298
}
3299
3299
3300
3300
/// Walks the expression and returns the leftmost multiline string literal (which might be the
3301
- /// expression itself) if the leftmost child is a multiline string literal.
3301
+ /// expression itself) if the leftmost child is a multiline string literal or if it is a unary
3302
+ /// operation applied to a multiline string literal.
3302
3303
///
3303
3304
/// - Parameter expr: The expression whose leftmost multiline string literal should be returned.
3304
3305
/// - Returns: The leftmost multiline string literal, or nil if the leftmost subexpression was
@@ -3310,8 +3311,28 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
3310
3311
return stringLiteralExpr
3311
3312
case . infixOperatorExpr( let infixOperatorExpr) :
3312
3313
return leftmostMultilineStringLiteral ( of: infixOperatorExpr. leftOperand)
3314
+ case . asExpr( let asExpr) :
3315
+ return leftmostMultilineStringLiteral ( of: asExpr. expression)
3316
+ case . isExpr( let isExpr) :
3317
+ return leftmostMultilineStringLiteral ( of: isExpr. expression)
3318
+ case . forcedValueExpr( let forcedValueExpr) :
3319
+ return leftmostMultilineStringLiteral ( of: forcedValueExpr. expression)
3320
+ case . optionalChainingExpr( let optionalChainingExpr) :
3321
+ return leftmostMultilineStringLiteral ( of: optionalChainingExpr. expression)
3322
+ case . postfixUnaryExpr( let postfixUnaryExpr) :
3323
+ return leftmostMultilineStringLiteral ( of: postfixUnaryExpr. expression)
3324
+ case . prefixOperatorExpr( let prefixOperatorExpr) :
3325
+ return leftmostMultilineStringLiteral ( of: prefixOperatorExpr. postfixExpression)
3313
3326
case . ternaryExpr( let ternaryExpr) :
3314
3327
return leftmostMultilineStringLiteral ( of: ternaryExpr. conditionExpression)
3328
+ case . functionCallExpr( let functionCallExpr) :
3329
+ return leftmostMultilineStringLiteral ( of: functionCallExpr. calledExpression)
3330
+ case . subscriptExpr( let subscriptExpr) :
3331
+ return leftmostMultilineStringLiteral ( of: subscriptExpr. calledExpression)
3332
+ case . memberAccessExpr( let memberAccessExpr) :
3333
+ return memberAccessExpr. base. flatMap { leftmostMultilineStringLiteral ( of: $0) }
3334
+ case . postfixIfConfigExpr( let postfixIfConfigExpr) :
3335
+ return postfixIfConfigExpr. base. flatMap { leftmostMultilineStringLiteral ( of: $0) }
3315
3336
default :
3316
3337
return nil
3317
3338
}
0 commit comments