@@ -1299,8 +1299,8 @@ emitMarkFunctionEscapeForTopLevelCodeGlobals(SILLocation loc,
12991299}
13001300
13011301void 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 ());
13041304
13051305 // If this is a function at global scope, it may close over a global variable.
13061306 // If we're emitting top-level code, then emit a "mark_function_escape" that
@@ -1389,6 +1389,9 @@ SILFunction *SILGenModule::emitClosure(AbstractClosureExpr *ce) {
13891389 if (!f->isExternalDeclaration ())
13901390 return f;
13911391
1392+ // Emit property wrapper argument generators.
1393+ emitArgumentGenerators (ce, ce->getParameters ());
1394+
13921395 emitFunctionDefinition (constant, f);
13931396 return f;
13941397}
@@ -1587,13 +1590,17 @@ void SILGenModule::emitGlobalAccessor(VarDecl *global,
15871590 emitOrDelayFunction (*this , accessor);
15881591}
15891592
1590- void SILGenModule::emitDefaultArgGenerators (SILDeclRef::Loc decl,
1591- ParameterList *paramList) {
1593+ void SILGenModule::emitArgumentGenerators (SILDeclRef::Loc decl,
1594+ ParameterList *paramList) {
15921595 unsigned index = 0 ;
15931596 for (auto param : *paramList) {
15941597 if (param->isDefaultArgument ())
15951598 emitDefaultArgGenerator (SILDeclRef::getDefaultArgGenerator (decl, index),
15961599 param);
1600+
1601+ if (param->hasExternalPropertyWrapper ())
1602+ emitPropertyWrapperBackingInitializer (param);
1603+
15971604 ++index;
15981605 }
15991606}
0 commit comments