Add a request to lazily parse function bodies.

Rework the lazy function body parsing mechanism to use the
request-evaluator, so that asking for the body of a function will
initiate parsing. Clean up a number of callers to
AbstractFunctionDecl::getBody() that don't actually need the body, so
we don't perform unnecessary parsing.

This change does not delay parsing of function bodies in the general
case; rather, it sets up the infrastructure to always delay parsing of
function bodies.
This commit is contained in:
Doug Gregor
2019-08-30 16:48:23 -07:00
parent 1cd5d2edb3
commit d8b745db77
15 changed files with 161 additions and 93 deletions

View File

@@ -152,9 +152,6 @@ ModuleDecl *SourceLoader::loadModule(SourceLoc importLoc,
assert(done && "Parser returned early?");
(void)done;
if (SkipBodies)
performDelayedParsing(importMod, persistentState, nullptr);
// FIXME: Support recursive definitions in immediate modes by making type
// checking even lazier.
if (SkipBodies)