@@ -1625,12 +1625,37 @@ bool ReferencedActor::isKnownToBeLocal() const {
1625
1625
}
1626
1626
}
1627
1627
1628
- static AbstractFunctionDecl const *
1629
- isActorInitOrDeInitContext (const DeclContext *dc) {
1630
- return swift::isActorInitOrDeInitContext (
1631
- dc, [](const AbstractClosureExpr *closure) {
1632
- return isSendableClosure (closure, /* forActorIsolation=*/ false );
1633
- });
1628
+ const AbstractFunctionDecl *
1629
+ swift::isActorInitOrDeInitContext (const DeclContext *dc) {
1630
+ while (true ) {
1631
+ // Non-Sendable closures are considered part of the enclosing context.
1632
+ if (auto *closure = dyn_cast<AbstractClosureExpr>(dc)) {
1633
+ if (isSendableClosure (closure, /* for actor isolation*/ false ))
1634
+ return nullptr ;
1635
+
1636
+ dc = dc->getParent ();
1637
+ continue ;
1638
+ }
1639
+
1640
+ if (auto func = dyn_cast<AbstractFunctionDecl>(dc)) {
1641
+ // If this is an initializer or deinitializer of an actor, we're done.
1642
+ if ((isa<ConstructorDecl>(func) || isa<DestructorDecl>(func)) &&
1643
+ getSelfActorDecl (dc->getParent ()))
1644
+ return func;
1645
+
1646
+ // Non-Sendable local functions are considered part of the enclosing
1647
+ // context.
1648
+ if (func->getDeclContext ()->isLocalContext ()) {
1649
+ if (func->isSendable ())
1650
+ return nullptr ;
1651
+
1652
+ dc = dc->getParent ();
1653
+ continue ;
1654
+ }
1655
+ }
1656
+
1657
+ return nullptr ;
1658
+ }
1634
1659
}
1635
1660
1636
1661
static bool isStoredProperty (ValueDecl const *member) {
@@ -6467,40 +6492,6 @@ bool swift::completionContextUsesConcurrencyFeatures(const DeclContext *dc) {
6467
6492
});
6468
6493
}
6469
6494
6470
- AbstractFunctionDecl const *swift::isActorInitOrDeInitContext (
6471
- const DeclContext *dc,
6472
- llvm::function_ref<bool (const AbstractClosureExpr *)> isSendable) {
6473
- while (true ) {
6474
- // Non-Sendable closures are considered part of the enclosing context.
6475
- if (auto *closure = dyn_cast<AbstractClosureExpr>(dc)) {
6476
- if (isSendable (closure))
6477
- return nullptr ;
6478
-
6479
- dc = dc->getParent ();
6480
- continue ;
6481
- }
6482
-
6483
- if (auto func = dyn_cast<AbstractFunctionDecl>(dc)) {
6484
- // If this is an initializer or deinitializer of an actor, we're done.
6485
- if ((isa<ConstructorDecl>(func) || isa<DestructorDecl>(func)) &&
6486
- getSelfActorDecl (dc->getParent ()))
6487
- return func;
6488
-
6489
- // Non-Sendable local functions are considered part of the enclosing
6490
- // context.
6491
- if (func->getDeclContext ()->isLocalContext ()) {
6492
- if (func->isSendable ())
6493
- return nullptr ;
6494
-
6495
- dc = dc->getParent ();
6496
- continue ;
6497
- }
6498
- }
6499
-
6500
- return nullptr ;
6501
- }
6502
- }
6503
-
6504
6495
// / Find the directly-referenced parameter or capture of a parameter for
6505
6496
// / for the given expression.
6506
6497
VarDecl *swift::getReferencedParamOrCapture (
0 commit comments