File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -5287,6 +5287,10 @@ class ConstraintSystem {
5287
5287
// / part of the constraint system.
5288
5288
void forEachExpr (Expr *expr, llvm::function_ref<Expr *(Expr *)> callback);
5289
5289
5290
+ // / Determine whether one of the parent closures the given one is nested
5291
+ // / in (if any) has a result builder applied to its body.
5292
+ bool isInResultBuilderContext (ClosureExpr *closure) const ;
5293
+
5290
5294
SWIFT_DEBUG_DUMP;
5291
5295
SWIFT_DEBUG_DUMPER (dump(Expr *));
5292
5296
Original file line number Diff line number Diff line change @@ -919,6 +919,19 @@ bool ConstraintSystem::generateConstraints(ClosureExpr *closure) {
919
919
return false ;
920
920
}
921
921
922
+ bool ConstraintSystem::isInResultBuilderContext (ClosureExpr *closure) const {
923
+ if (!closure->hasSingleExpressionBody ()) {
924
+ auto *DC = closure->getParent ();
925
+ do {
926
+ if (auto *parentClosure = dyn_cast<ClosureExpr>(DC)) {
927
+ if (resultBuilderTransformed.count (parentClosure))
928
+ return true ;
929
+ }
930
+ } while ((DC = DC->getParent ()));
931
+ }
932
+ return false ;
933
+ }
934
+
922
935
bool isConditionOfStmt (ConstraintLocatorBuilder locator) {
923
936
auto last = locator.last ();
924
937
if (!(last && last->is <LocatorPathElt::Condition>()))
You can’t perform that action at this time.
0 commit comments