[SourceKit] Expand editor placeholder to trailing closures inside a TryExpr

rdar://108391690
This commit is contained in:
Alex Hoppen
2023-04-21 17:20:44 -07:00
parent ce5bef8f4d
commit aef35b917e
2 changed files with 24 additions and 1 deletions

View File

@@ -1658,7 +1658,14 @@ private:
auto SR = E->getSourceRange();
if (SR.isValid() && SM.rangeContainsTokenLoc(SR, TargetLoc) &&
!checkCallExpr(E) && !EnclosingCallAndArg.first) {
OuterExpr = E;
if (!isa<TryExpr>(E) && !isa<AwaitExpr>(E) &&
!isa<PrefixUnaryExpr>(E)) {
// We don't want to expand to trailing closures if the call is
// nested inside another expression that has closing characters,
// like a `)` for a function call. This is not the case for
// `try`, `await` and prefix operator applications.
OuterExpr = E;
}
}
return true;
}