@@ -442,12 +442,9 @@ bool SILDeclRef::isTransparent() const {
442
442
443
443
// / True if the function should have its body serialized.
444
444
IsSerialized_t SILDeclRef::isSerialized () const {
445
- DeclContext *dc;
446
445
if (auto closure = getAbstractClosureExpr ()) {
447
- dc = closure->getLocalContext ();
448
-
449
- // Otherwise, ask the AST if we're inside an @inlinable context.
450
- if (dc->getResilienceExpansion () == ResilienceExpansion::Minimal) {
446
+ // Ask the AST if we're inside an @inlinable context.
447
+ if (closure->getResilienceExpansion () == ResilienceExpansion::Minimal) {
451
448
if (isForeign)
452
449
return IsSerializable;
453
450
@@ -465,6 +462,13 @@ IsSerialized_t SILDeclRef::isSerialized() const {
465
462
// Default argument generators are serialized if the containing
466
463
// declaration is public.
467
464
if (isDefaultArgGenerator ()) {
465
+ // Ask the AST if we're inside an @inlinable context.
466
+ if (d->getDeclContext ()->getResilienceExpansion ()
467
+ == ResilienceExpansion::Minimal) {
468
+ return IsSerialized;
469
+ }
470
+
471
+ // Otherwise, check if the owning declaration is public.
468
472
auto scope =
469
473
d->getFormalAccessScope (/* useDC=*/ nullptr ,
470
474
/* treatUsableFromInlineAsPublic=*/ true );
@@ -490,7 +494,7 @@ IsSerialized_t SILDeclRef::isSerialized() const {
490
494
491
495
// Note: if 'd' is a function, then 'dc' is the function itself, not
492
496
// its parent context.
493
- dc = d->getInnermostDeclContext ();
497
+ auto * dc = d->getInnermostDeclContext ();
494
498
495
499
// Local functions are serializable if their parent function is
496
500
// serializable.
0 commit comments