@@ -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}
@@ -1575,13 +1578,17 @@ void SILGenModule::emitGlobalAccessor(VarDecl *global,
15751578 emitOrDelayFunction (*this , accessor);
15761579}
15771580
1578- void SILGenModule::emitDefaultArgGenerators (SILDeclRef::Loc decl,
1579- ParameterList *paramList) {
1581+ void SILGenModule::emitArgumentGenerators (SILDeclRef::Loc decl,
1582+ ParameterList *paramList) {
15801583 unsigned index = 0 ;
15811584 for (auto param : *paramList) {
15821585 if (param->isDefaultArgument ())
15831586 emitDefaultArgGenerator (SILDeclRef::getDefaultArgGenerator (decl, index),
15841587 param);
1588+
1589+ if (param->hasExternalPropertyWrapper ())
1590+ emitPropertyWrapperBackingInitializer (param);
1591+
15851592 ++index;
15861593 }
15871594}
0 commit comments