@@ -6097,35 +6097,35 @@ static bool hasCurriedSelf(ConstraintSystem &cs, ConcreteDeclRef callee,
60976097}
60986098
60996099// / Apply the contextually Sendable flag to the given expression,
6100- static void applyContextualClosureFlags (Expr *expr, bool implicitSelfCapture,
6101- bool inheritActorContext,
6102- bool isPassedToSendingParameter,
6100+ static void applyContextualClosureFlags (Expr *expr, unsigned paramIdx,
6101+ const ParameterListInfo ¶mInfo,
61036102 bool requiresDynamicIsolationChecking,
61046103 bool isMacroArg) {
61056104 if (auto closure = dyn_cast<ClosureExpr>(expr)) {
6106- closure->setAllowsImplicitSelfCapture (implicitSelfCapture);
6107- closure->setInheritsActorContext (inheritActorContext);
6108- closure->setIsPassedToSendingParameter (isPassedToSendingParameter);
6105+ closure->setAllowsImplicitSelfCapture (
6106+ paramInfo.isImplicitSelfCapture (paramIdx));
6107+
6108+ auto [inheritActorContext, modifier] =
6109+ paramInfo.inheritsActorContext (paramIdx);
6110+ closure->setInheritsActorContext (inheritActorContext, modifier);
6111+
6112+ closure->setIsPassedToSendingParameter (
6113+ paramInfo.isSendingParameter (paramIdx));
61096114 closure->setRequiresDynamicIsolationChecking (
61106115 requiresDynamicIsolationChecking);
61116116 closure->setIsMacroArgument (isMacroArg);
61126117 return ;
61136118 }
61146119
61156120 if (auto captureList = dyn_cast<CaptureListExpr>(expr)) {
6116- applyContextualClosureFlags (captureList->getClosureBody (),
6117- implicitSelfCapture, inheritActorContext,
6118- isPassedToSendingParameter,
6119- requiresDynamicIsolationChecking,
6121+ applyContextualClosureFlags (captureList->getClosureBody (), paramIdx,
6122+ paramInfo, requiresDynamicIsolationChecking,
61206123 isMacroArg);
61216124 }
61226125
61236126 if (auto identity = dyn_cast<IdentityExpr>(expr)) {
6124- applyContextualClosureFlags (identity->getSubExpr (), implicitSelfCapture,
6125- inheritActorContext,
6126- isPassedToSendingParameter,
6127- requiresDynamicIsolationChecking,
6128- isMacroArg);
6127+ applyContextualClosureFlags (identity->getSubExpr (), paramIdx, paramInfo,
6128+ requiresDynamicIsolationChecking, isMacroArg);
61296129 }
61306130}
61316131
@@ -6251,19 +6251,13 @@ ArgumentList *ExprRewriter::coerceCallArguments(
62516251
62526252 auto applyFlagsToArgument = [¶mInfo,
62536253 &closuresRequireDynamicIsolationChecking,
6254- &locator](
6255- unsigned paramIdx, Expr *argument) {
6254+ &locator](unsigned paramIdx, Expr *argument) {
62566255 if (!isClosureLiteralExpr (argument))
62576256 return ;
62586257
6259- bool isImplicitSelfCapture = paramInfo.isImplicitSelfCapture (paramIdx);
6260- bool inheritsActorContext = paramInfo.inheritsActorContext (paramIdx);
6261- bool isPassedToSendingParameter = paramInfo.isSendingParameter (paramIdx);
62626258 bool isMacroArg = isExpr<MacroExpansionExpr>(locator.getAnchor ());
62636259
6264- applyContextualClosureFlags (argument, isImplicitSelfCapture,
6265- inheritsActorContext,
6266- isPassedToSendingParameter,
6260+ applyContextualClosureFlags (argument, paramIdx, paramInfo,
62676261 closuresRequireDynamicIsolationChecking,
62686262 isMacroArg);
62696263 };
0 commit comments