@@ -2427,6 +2427,8 @@ namespace {
2427
2427
}
2428
2428
2429
2429
void checkDefaultArgument (DefaultArgumentExpr *expr) {
2430
+ getCurrentContextIsolation (expr);
2431
+
2430
2432
// Check the context isolation against the required isolation for
2431
2433
// evaluating the default argument synchronously. If the default
2432
2434
// argument must be evaluated asynchronously, record that in the
@@ -3378,19 +3380,8 @@ namespace {
3378
3380
3379
3381
// FIXME: CurrentContextIsolationExpr does not have its actor set
3380
3382
// at this point.
3381
- if (auto *defaultArg = dyn_cast<DefaultArgumentExpr>(arg)) {
3382
- // Look through caller-side default arguments for #isolation.
3383
- if (defaultArg->isCallerSide ()) {
3384
- arg = defaultArg->getCallerSideDefaultExpr ();
3385
- }
3386
- }
3387
- if (auto *macro = dyn_cast<MacroExpansionExpr>(arg)) {
3388
- auto *expansion = macro->getRewritten ();
3389
- if (auto *isolation = dyn_cast<CurrentContextIsolationExpr>(expansion)) {
3390
- recordCurrentContextIsolation (isolation);
3391
- arg = isolation->getActor ();
3392
- }
3393
- }
3383
+ if (auto isolation = getCurrentContextIsolation (arg))
3384
+ arg = isolation;
3394
3385
3395
3386
argForIsolatedParam = arg;
3396
3387
unsatisfiedIsolation = std::nullopt;
@@ -3553,6 +3544,25 @@ namespace {
3553
3544
return false ;
3554
3545
}
3555
3546
3547
+ Expr *getCurrentContextIsolation (Expr *expr) {
3548
+ // Look through caller-side default arguments for #isolation.
3549
+ auto *defaultArg = dyn_cast<DefaultArgumentExpr>(expr);
3550
+ if (defaultArg && defaultArg->isCallerSide ()) {
3551
+ expr = defaultArg->getCallerSideDefaultExpr ();
3552
+ }
3553
+
3554
+ if (auto *macro = dyn_cast<MacroExpansionExpr>(expr)) {
3555
+ expr = macro->getRewritten ();
3556
+ }
3557
+
3558
+ if (auto *isolation = dyn_cast<CurrentContextIsolationExpr>(expr)) {
3559
+ recordCurrentContextIsolation (isolation);
3560
+ return isolation->getActor ();
3561
+ }
3562
+
3563
+ return nullptr ;
3564
+ }
3565
+
3556
3566
void recordCurrentContextIsolation (
3557
3567
CurrentContextIsolationExpr *isolationExpr) {
3558
3568
// If an actor has already been assigned, we're done.
0 commit comments