File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -5300,6 +5300,9 @@ class VarDecl : public AbstractStorageDecl {
5300
5300
// / Returns true if the name is the self identifier and is implicit.
5301
5301
bool isSelfParameter () const ;
5302
5302
5303
+ // / Check whether the variable is the "self" of an actor method.
5304
+ bool isActorSelf () const ;
5305
+
5303
5306
// / Determine whether this property will be part of the implicit memberwise
5304
5307
// / initializer.
5305
5308
// /
Original file line number Diff line number Diff line change @@ -6042,6 +6042,20 @@ bool VarDecl::isSelfParameter() const {
6042
6042
return false ;
6043
6043
}
6044
6044
6045
+ bool VarDecl::isActorSelf () const {
6046
+ if (!isSelfParameter () && !isSelfParamCapture ())
6047
+ return false ;
6048
+
6049
+ auto *dc = getDeclContext ();
6050
+ while (!dc->isTypeContext () && !dc->isModuleScopeContext ())
6051
+ dc = dc->getParent ();
6052
+
6053
+ // Check if this `self` parameter belogs to an actor declaration or
6054
+ // extension.
6055
+ auto nominal = dc->getSelfNominalTypeDecl ();
6056
+ return nominal && nominal->isActor ();
6057
+ }
6058
+
6045
6059
// / Whether the given variable is the backing storage property for
6046
6060
// / a declared property that is either `lazy` or has an attached
6047
6061
// / property wrapper.
You can’t perform that action at this time.
0 commit comments