Skip to content

Commit f9879b1

Browse files
committed
[ASTGen] Add VarDecls to member contexts
Ensure we add any bound vars to a type or extension context.
1 parent b04d5d5 commit f9879b1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/AST/ASTBridging.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,15 @@ static void setParsedMembers(IterableDeclContext *IDC,
563563
SmallVector<Decl *> members;
564564
for (auto *decl : bridgedMembers.unbridged<Decl *>()) {
565565
members.push_back(decl);
566+
567+
// Add any variables bound to the list of decls.
568+
if (auto *PBD = dyn_cast<PatternBindingDecl>(decl)) {
569+
for (auto idx : range(PBD->getNumPatternEntries())) {
570+
PBD->getPattern(idx)->forEachVariable([&](VarDecl *VD) {
571+
members.push_back(VD);
572+
});
573+
}
574+
}
566575
// Each enum case element is also part of the members list according to the
567576
// legacy parser.
568577
if (auto *ECD = dyn_cast<EnumCaseDecl>(decl)) {

0 commit comments

Comments
 (0)