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