@@ -334,9 +334,10 @@ class alignas(8) Expr {
334
334
NumCaptures : 32
335
335
);
336
336
337
- SWIFT_INLINE_BITFIELD (ApplyExpr, Expr, 1 +1 ,
337
+ SWIFT_INLINE_BITFIELD (ApplyExpr, Expr, 1 +1 + 1 ,
338
338
ThrowsIsSet : 1 ,
339
- Throws : 1
339
+ Throws : 1 ,
340
+ ImplicitlyAsync : 1
340
341
);
341
342
342
343
SWIFT_INLINE_BITFIELD_FULL (CallExpr, ApplyExpr, 1 +1 +16 ,
@@ -4308,6 +4309,7 @@ class ApplyExpr : public Expr {
4308
4309
assert (classof ((Expr*)this ) && " ApplyExpr::classof out of date" );
4309
4310
assert (validateArg (Arg) && " Arg is not a permitted expr kind" );
4310
4311
Bits.ApplyExpr .ThrowsIsSet = false ;
4312
+ Bits.ApplyExpr .ImplicitlyAsync = false ;
4311
4313
}
4312
4314
4313
4315
public:
@@ -4346,6 +4348,29 @@ class ApplyExpr : public Expr {
4346
4348
Bits.ApplyExpr .Throws = throws;
4347
4349
}
4348
4350
4351
+ // / Is this application _implicitly_ required to be an async call?
4352
+ // / Note that this is _not_ a check for whether the callee is async!
4353
+ // / Only meaningful after complete type-checking.
4354
+ // /
4355
+ // / Generally, this comes up only when we have a non-self call to an actor
4356
+ // / instance's synchronous method. Such calls are conceptually treated as if
4357
+ // / they are wrapped with an async closure. For example,
4358
+ // /
4359
+ // / act.syncMethod(a, b)
4360
+ // /
4361
+ // / is equivalent to the eta-expanded version of act.syncMethod,
4362
+ // /
4363
+ // / { (a1, b1) async in act.syncMethod(a1, b1) }(a, b)
4364
+ // /
4365
+ // / where the new closure is declared to be async.
4366
+ // /
4367
+ bool implicitlyAsync () const {
4368
+ return Bits.ApplyExpr .ImplicitlyAsync ;
4369
+ }
4370
+ void setImplicitlyAsync (bool flag) {
4371
+ Bits.ApplyExpr .ImplicitlyAsync = flag;
4372
+ }
4373
+
4349
4374
ValueDecl *getCalledValue () const ;
4350
4375
4351
4376
// / Retrieve the argument labels provided at the call site.
0 commit comments