Skip to content

Commit 04e8bad

Browse files
committed
[concurrency] Add a new method ActorIsolation::forActorInstanceSelf.
This occurs when working with ActorIsolation in SIL. This lets us avoid needing to depend on the AST for getting ActorIsolation for self parameters. Now, we can just create the actor isolation we need based off of the decl that we have. The code is based off of forActorInstanceSelf(ValueDecl *decl) along the path where it just creates isolation based off of the decl's nominal type decl (which is equivalent to what we are trying to do here).
1 parent 19dd44b commit 04e8bad

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

include/swift/AST/ActorIsolation.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ class ActorIsolation {
111111

112112
static ActorIsolation forActorInstanceSelf(ValueDecl *decl);
113113

114+
/// Create an ActorIsolation appropriate for a type that is self.
115+
static ActorIsolation forActorInstanceSelf(NominalTypeDecl *decl);
116+
114117
static ActorIsolation forActorInstanceParameter(NominalTypeDecl *actor,
115118
unsigned parameterIndex) {
116119
return ActorIsolation(ActorInstance, actor, parameterIndex + 1);

lib/AST/Decl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11370,6 +11370,10 @@ ActorIsolation::forActorInstanceSelf(ValueDecl *decl) {
1137011370
return ActorIsolation(ActorInstance, dc->getSelfNominalTypeDecl(), 0);
1137111371
}
1137211372

11373+
ActorIsolation ActorIsolation::forActorInstanceSelf(NominalTypeDecl *selfDecl) {
11374+
return ActorIsolation(ActorInstance, selfDecl, 0);
11375+
}
11376+
1137311377
NominalTypeDecl *ActorIsolation::getActor() const {
1137411378
assert(getKind() == ActorInstance ||
1137511379
getKind() == GlobalActor);

0 commit comments

Comments
 (0)