[AST] Clean up CaptureListEntry

Don't store a VarDecl separately, expose a `getVar`
accessor that forwards onto `getSingleVar`, and
rename `Init` to `PBD`.
This commit is contained in:
Hamish Knight
2021-06-08 22:56:06 +01:00
parent cc62c116f8
commit c1b1feb8e7
14 changed files with 47 additions and 41 deletions

View File

@@ -1569,7 +1569,7 @@ ManagedValue emitCFunctionPointer(SILGenFunction &SGF,
DebugScope scope(SGF, CleanupLocation(captureList));
// CaptureListExprs evaluate their bound variables.
for (auto capture : captureList->getCaptureList())
SGF.visit(capture.Init);
SGF.visit(capture.PBD);
// Emit the closure body.
auto *closure = captureList->getClosureBody();
@@ -2417,7 +2417,7 @@ RValue RValueEmitter::visitCaptureListExpr(CaptureListExpr *E, SGFContext C) {
DebugScope scope(SGF, CleanupLocation(E));
// CaptureListExprs evaluate their bound variables.
for (auto capture : E->getCaptureList())
SGF.visit(capture.Init);
SGF.visit(capture.PBD);
// Then they evaluate to their body.
return visit(E->getClosureBody(), C);