mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Frontend] Inline parseAndCheckTypesUpTo
`performSemaUpTo` will only shrink from here, so go ahead and inline `parseAndCheckTypesUpTo` into it already.
This commit is contained in:
@@ -794,7 +794,40 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) {
|
||||
MainBufferID);
|
||||
}
|
||||
|
||||
parseAndCheckTypesUpTo(LimitStage);
|
||||
bool hadLoadError = parsePartialModulesAndInputFiles();
|
||||
if (hadLoadError)
|
||||
return;
|
||||
|
||||
assert(llvm::all_of(MainModule->getFiles(), [](const FileUnit *File) -> bool {
|
||||
auto *SF = dyn_cast<SourceFile>(File);
|
||||
if (!SF)
|
||||
return true;
|
||||
return SF->ASTStage >= SourceFile::ImportsResolved;
|
||||
}) && "some files have not yet had their imports resolved");
|
||||
MainModule->setHasResolvedImports();
|
||||
|
||||
forEachFileToTypeCheck([&](SourceFile &SF) {
|
||||
if (LimitStage == SourceFile::ImportsResolved) {
|
||||
bindExtensions(SF);
|
||||
return;
|
||||
}
|
||||
|
||||
performTypeChecking(SF);
|
||||
|
||||
// Parse the SIL decls if needed.
|
||||
// TODO: Requestify SIL parsing.
|
||||
if (TheSILModule) {
|
||||
SILParserState SILContext(TheSILModule.get());
|
||||
parseSourceFileSIL(SF, &SILContext);
|
||||
}
|
||||
});
|
||||
|
||||
// If the limiting AST stage is import resolution, we're done.
|
||||
if (LimitStage <= SourceFile::ImportsResolved) {
|
||||
return;
|
||||
}
|
||||
|
||||
finishTypeChecking();
|
||||
}
|
||||
|
||||
bool CompilerInstance::loadStdlib() {
|
||||
@@ -816,46 +849,6 @@ bool CompilerInstance::loadStdlib() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void CompilerInstance::parseAndCheckTypesUpTo(
|
||||
SourceFile::ASTStage_t limitStage) {
|
||||
FrontendStatsTracer tracer(getStatsReporter(), "parse-and-check-types");
|
||||
|
||||
bool hadLoadError = parsePartialModulesAndInputFiles();
|
||||
if (hadLoadError)
|
||||
return;
|
||||
|
||||
assert(llvm::all_of(MainModule->getFiles(), [](const FileUnit *File) -> bool {
|
||||
auto *SF = dyn_cast<SourceFile>(File);
|
||||
if (!SF)
|
||||
return true;
|
||||
return SF->ASTStage >= SourceFile::ImportsResolved;
|
||||
}) && "some files have not yet had their imports resolved");
|
||||
MainModule->setHasResolvedImports();
|
||||
|
||||
forEachFileToTypeCheck([&](SourceFile &SF) {
|
||||
if (limitStage == SourceFile::ImportsResolved) {
|
||||
bindExtensions(SF);
|
||||
return;
|
||||
}
|
||||
|
||||
performTypeChecking(SF);
|
||||
|
||||
// Parse the SIL decls if needed.
|
||||
// TODO: Requestify SIL parsing.
|
||||
if (TheSILModule) {
|
||||
SILParserState SILContext(TheSILModule.get());
|
||||
parseSourceFileSIL(SF, &SILContext);
|
||||
}
|
||||
});
|
||||
|
||||
// If the limiting AST stage is import resolution, we're done.
|
||||
if (limitStage <= SourceFile::ImportsResolved) {
|
||||
return;
|
||||
}
|
||||
|
||||
finishTypeChecking();
|
||||
}
|
||||
|
||||
bool CompilerInstance::parsePartialModulesAndInputFiles() {
|
||||
FrontendStatsTracer tracer(getStatsReporter(),
|
||||
"parse-partial-modules-and-input-files");
|
||||
|
||||
Reference in New Issue
Block a user