Skip to content

Commit 6a1f8c7

Browse files
committed
[Sema] Re-parent AccessorDecls for local vars too
Make sure we walk into any non-DeclContext decl, allowing us to e.g walk into VarDecls to correctly re-contextualize their accessors in an outer autoclosure. I don't *think* this currently makes much of a difference since the mangling today uses the DeclContext of the VarDecl, but it seems like the right thing to do regardless.
1 parent af9e0c1 commit 6a1f8c7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Sema/TypeCheckStmt.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ namespace {
163163
D->setDeclContext(ParentDC);
164164
});
165165

166-
return Action::VisitNodeIf(isa<PatternBindingDecl>(D));
166+
// Only recurse into decls that aren't themselves DeclContexts. This
167+
// allows us to visit e.g initializers for PatternBindingDecls and
168+
// accessors for VarDecls.
169+
return Action::SkipNodeIf(isa<DeclContext>(D));
167170
}
168171
};
169172

0 commit comments

Comments
 (0)