@@ -292,10 +292,18 @@ class alignas(8) Expr {
292292 Kind : 2
293293 );
294294
295- SWIFT_INLINE_BITFIELD (ClosureExpr, AbstractClosureExpr, 1 ,
295+ SWIFT_INLINE_BITFIELD (ClosureExpr, AbstractClosureExpr, 1 + 1 + 1 ,
296296 // / True if closure parameters were synthesized from anonymous closure
297297 // / variables.
298- HasAnonymousClosureVars : 1
298+ HasAnonymousClosureVars : 1 ,
299+
300+ // / True if "self" can be captured implicitly without requiring "self."
301+ // / on each member reference.
302+ ImplicitSelfCapture : 1 ,
303+
304+ // / True if this @Sendable async closure parameter should implicitly
305+ // / inherit the actor context from where it was formed.
306+ InheritActorContext : 1
299307 );
300308
301309 SWIFT_INLINE_BITFIELD_FULL (BindOptionalExpr, Expr, 16 ,
@@ -3871,6 +3879,8 @@ class ClosureExpr : public AbstractClosureExpr {
38713879 Body(nullptr ) {
38723880 setParameterList (params);
38733881 Bits.ClosureExpr .HasAnonymousClosureVars = false ;
3882+ Bits.ClosureExpr .ImplicitSelfCapture = false ;
3883+ Bits.ClosureExpr .InheritActorContext = false ;
38743884 }
38753885
38763886 SourceRange getSourceRange () const ;
@@ -3898,7 +3908,27 @@ class ClosureExpr : public AbstractClosureExpr {
38983908 void setHasAnonymousClosureVars () {
38993909 Bits.ClosureExpr .HasAnonymousClosureVars = true ;
39003910 }
3901-
3911+
3912+ // / Whether this closure allows "self" to be implicitly captured without
3913+ // / required "self." on each reference.
3914+ bool allowsImplicitSelfCapture () const {
3915+ return Bits.ClosureExpr .ImplicitSelfCapture ;
3916+ }
3917+
3918+ void setAllowsImplicitSelfCapture (bool value = true ) {
3919+ Bits.ClosureExpr .ImplicitSelfCapture = value;
3920+ }
3921+
3922+ // / Whether this closure should implicitly inherit the actor context from
3923+ // / where it was formed. This only affects @Sendable async closures.
3924+ bool inheritsActorContext () const {
3925+ return Bits.ClosureExpr .InheritActorContext ;
3926+ }
3927+
3928+ void setInheritsActorContext (bool value = true ) {
3929+ Bits.ClosureExpr .InheritActorContext = value;
3930+ }
3931+
39023932 // / Determine whether this closure expression has an
39033933 // / explicitly-specified result type.
39043934 bool hasExplicitResultType () const { return ArrowLoc.isValid (); }
0 commit comments