File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,7 @@ class ActorIsolation {
192
192
}
193
193
194
194
NominalTypeDecl *getActor () const ;
195
+ NominalTypeDecl *getActorOrNullPtr () const ;
195
196
196
197
VarDecl *getActorInstance () const ;
197
198
Original file line number Diff line number Diff line change @@ -11348,6 +11348,31 @@ NominalTypeDecl *ActorIsolation::getActor() const {
11348
11348
return actorInstance.get <NominalTypeDecl *>();
11349
11349
}
11350
11350
11351
+ NominalTypeDecl *ActorIsolation::getActorOrNullPtr () const {
11352
+ if (getKind () != ActorInstance || getKind () != GlobalActor)
11353
+ return nullptr ;
11354
+
11355
+ if (silParsed)
11356
+ return nullptr ;
11357
+
11358
+ Type actorType;
11359
+
11360
+ if (auto *instance = actorInstance.dyn_cast <VarDecl *>()) {
11361
+ actorType = instance->getTypeInContext ();
11362
+ } else if (auto *instance = actorInstance.dyn_cast <Expr *>()) {
11363
+ actorType = instance->getType ();
11364
+ }
11365
+
11366
+ if (actorType) {
11367
+ if (auto wrapped = actorType->getOptionalObjectType ()) {
11368
+ actorType = wrapped;
11369
+ }
11370
+ return actorType->getReferenceStorageReferent ()->getAnyActor ();
11371
+ }
11372
+
11373
+ return actorInstance.get <NominalTypeDecl *>();
11374
+ }
11375
+
11351
11376
VarDecl *ActorIsolation::getActorInstance () const {
11352
11377
assert (getKind () == ActorInstance);
11353
11378
You can’t perform that action at this time.
0 commit comments