@@ -1299,8 +1299,8 @@ emitMarkFunctionEscapeForTopLevelCodeGlobals(SILLocation loc,
1299
1299
}
1300
1300
1301
1301
void SILGenModule::emitAbstractFuncDecl (AbstractFunctionDecl *AFD) {
1302
- // Emit any default argument generators .
1303
- emitDefaultArgGenerators (AFD, AFD->getParameters ());
1302
+ // Emit default arguments and property wrapper initializers .
1303
+ emitArgumentGenerators (AFD, AFD->getParameters ());
1304
1304
1305
1305
// If this is a function at global scope, it may close over a global variable.
1306
1306
// If we're emitting top-level code, then emit a "mark_function_escape" that
@@ -1389,6 +1389,9 @@ SILFunction *SILGenModule::emitClosure(AbstractClosureExpr *ce) {
1389
1389
if (!f->isExternalDeclaration ())
1390
1390
return f;
1391
1391
1392
+ // Emit property wrapper argument generators.
1393
+ emitArgumentGenerators (ce, ce->getParameters ());
1394
+
1392
1395
emitFunctionDefinition (constant, f);
1393
1396
return f;
1394
1397
}
@@ -1575,13 +1578,17 @@ void SILGenModule::emitGlobalAccessor(VarDecl *global,
1575
1578
emitOrDelayFunction (*this , accessor);
1576
1579
}
1577
1580
1578
- void SILGenModule::emitDefaultArgGenerators (SILDeclRef::Loc decl,
1579
- ParameterList *paramList) {
1581
+ void SILGenModule::emitArgumentGenerators (SILDeclRef::Loc decl,
1582
+ ParameterList *paramList) {
1580
1583
unsigned index = 0 ;
1581
1584
for (auto param : *paramList) {
1582
1585
if (param->isDefaultArgument ())
1583
1586
emitDefaultArgGenerator (SILDeclRef::getDefaultArgGenerator (decl, index),
1584
1587
param);
1588
+
1589
+ if (param->hasExternalPropertyWrapper ())
1590
+ emitPropertyWrapperBackingInitializer (param);
1591
+
1585
1592
++index;
1586
1593
}
1587
1594
}
0 commit comments