File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -3256,9 +3256,17 @@ void Parser::parseDeclDelayed() {
3256
3256
} else if (auto *ED = dyn_cast<ExtensionDecl>(parent)) {
3257
3257
ED->addMember (D);
3258
3258
} else if (auto *SF = dyn_cast<SourceFile>(parent)) {
3259
- // FIXME: unify notification to ASTSourceFileScope with addMember
3260
- // mechanism used above
3261
3259
SF->Decls .push_back (D);
3260
+ } else if (auto *CE = dyn_cast<ClosureExpr>(parent)) {
3261
+ // Replace the closure body with one including the new Decl.
3262
+ auto *body = CE->getBody ();
3263
+ SmallVector<ASTNode, 8 > Elts (body->getElements ().begin (),
3264
+ body->getElements ().end ());
3265
+ Elts.push_back (ASTNode (D));
3266
+ auto *newBody =
3267
+ BraceStmt::create (Context, body->getLBraceLoc (), Elts,
3268
+ body->getRBraceLoc (), body->isImplicit ());
3269
+ CE->setBody (newBody, false );
3262
3270
}
3263
3271
}
3264
3272
});
You can’t perform that action at this time.
0 commit comments