@@ -1277,8 +1277,8 @@ emitMarkFunctionEscapeForTopLevelCodeGlobals(SILLocation loc,
12771277}
12781278
12791279void SILGenModule::emitAbstractFuncDecl (AbstractFunctionDecl *AFD) {
1280- // Emit any default argument generators .
1281- emitDefaultArgGenerators (AFD, AFD->getParameters ());
1280+ // Emit default arguments and property wrapper initializers .
1281+ emitArgumentGenerators (AFD, AFD->getParameters ());
12821282
12831283 // If this is a function at global scope, it may close over a global variable.
12841284 // If we're emitting top-level code, then emit a "mark_function_escape" that
@@ -1373,6 +1373,9 @@ SILFunction *SILGenModule::emitClosure(AbstractClosureExpr *ce) {
13731373 if (!f->isExternalDeclaration ())
13741374 return f;
13751375
1376+ // Emit property wrapper argument generators.
1377+ emitArgumentGenerators (ce, ce->getParameters ());
1378+
13761379 emitFunctionDefinition (constant, f);
13771380 return f;
13781381}
@@ -1559,13 +1562,17 @@ void SILGenModule::emitGlobalAccessor(VarDecl *global,
15591562 emitOrDelayFunction (*this , accessor);
15601563}
15611564
1562- void SILGenModule::emitDefaultArgGenerators (SILDeclRef::Loc decl,
1563- ParameterList *paramList) {
1565+ void SILGenModule::emitArgumentGenerators (SILDeclRef::Loc decl,
1566+ ParameterList *paramList) {
15641567 unsigned index = 0 ;
15651568 for (auto param : *paramList) {
15661569 if (param->isDefaultArgument ())
15671570 emitDefaultArgGenerator (SILDeclRef::getDefaultArgGenerator (decl, index),
15681571 param);
1572+
1573+ if (param->hasExternalPropertyWrapper ())
1574+ emitPropertyWrapperBackingInitializer (param);
1575+
15691576 ++index;
15701577 }
15711578}
0 commit comments