@@ -649,11 +649,10 @@ emitMarkFunctionEscapeForTopLevelCodeGlobals(SILLocation loc,
649
649
650
650
void SILGenModule::emitAbstractFuncDecl (AbstractFunctionDecl *AFD) {
651
651
// Emit any default argument generators.
652
- {
653
- auto paramLists = AFD->getParameterLists ();
654
- if (AFD->getDeclContext ()->isTypeContext ())
655
- paramLists = paramLists.slice (1 );
656
- emitDefaultArgGenerators (AFD, paramLists);
652
+ if (!isa<DestructorDecl>(AFD)) {
653
+ unsigned paramListIndex = AFD->getDeclContext ()->isTypeContext () ? 1 : 0 ;
654
+ auto *paramList = AFD->getParameterLists ()[paramListIndex];
655
+ emitDefaultArgGenerators (AFD, paramList);
657
656
}
658
657
659
658
// If this is a function at global scope, it may close over a global variable.
@@ -1015,15 +1014,13 @@ void SILGenModule::emitGlobalGetter(VarDecl *global,
1015
1014
}
1016
1015
1017
1016
void SILGenModule::emitDefaultArgGenerators (SILDeclRef::Loc decl,
1018
- ArrayRef< ParameterList*> paramLists ) {
1017
+ ParameterList *paramList ) {
1019
1018
unsigned index = 0 ;
1020
- for (auto paramList : paramLists) {
1021
- for (auto param : *paramList) {
1022
- if (auto defaultArg = param->getDefaultValue ())
1023
- emitDefaultArgGenerator (SILDeclRef::getDefaultArgGenerator (decl, index),
1024
- defaultArg, param->getDefaultArgumentKind ());
1025
- ++index;
1026
- }
1019
+ for (auto param : *paramList) {
1020
+ if (auto defaultArg = param->getDefaultValue ())
1021
+ emitDefaultArgGenerator (SILDeclRef::getDefaultArgGenerator (decl, index),
1022
+ defaultArg, param->getDefaultArgumentKind ());
1023
+ ++index;
1027
1024
}
1028
1025
}
1029
1026
0 commit comments