Skip to content

Commit 05d33b9

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 5e44aec commit 05d33b9

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
@@ -173,7 +173,10 @@ namespace {
173173
D->setDeclContext(ParentDC);
174174
});
175175

176-
return Action::VisitNodeIf(isa<PatternBindingDecl>(D));
176+
// Only recurse into decls that aren't themselves DeclContexts. This
177+
// allows us to visit e.g initializers for PatternBindingDecls and
178+
// accessors for VarDecls.
179+
return Action::SkipNodeIf(isa<DeclContext>(D));
177180
}
178181
};
179182

0 commit comments

Comments
 (0)