Do 'bindExtensions()' as a part of 'performParseAndNameBindingOnly()'

This commit is contained in:
Rintaro Ishizaki
2019-11-06 12:50:41 -08:00
parent f6a76f51a0
commit d51d8447f0
5 changed files with 20 additions and 22 deletions

View File

@@ -843,18 +843,13 @@ void CompilerInstance::parseAndCheckTypesUpTo(
}) && "some files have not yet had their imports resolved");
MainModule->setHasResolvedImports();
// If the limiting AST stage is name binding, we're done.
if (limitStage <= SourceFile::NameBound) {
if (Invocation.isCodeCompletion()) {
performCodeCompletionSecondPass(*PersistentState.get(),
*Invocation.getCodeCompletionFactory());
}
return;
}
assert(!Invocation.isCodeCompletion());
const auto &options = Invocation.getFrontendOptions();
forEachFileToTypeCheck([&](SourceFile &SF) {
if (limitStage == SourceFile::NameBound) {
bindExtensions(SF);
return;
}
performTypeChecking(SF, PersistentState->getTopLevelContext(),
TypeCheckOptions, /*curElem*/ 0,
options.WarnLongFunctionBodies,
@@ -875,6 +870,17 @@ void CompilerInstance::parseAndCheckTypesUpTo(
}
});
if (Invocation.isCodeCompletion()) {
assert(limitStage == SourceFile::NameBound);
performCodeCompletionSecondPass(*PersistentState.get(),
*Invocation.getCodeCompletionFactory());
}
// If the limiting AST stage is name binding, we're done.
if (limitStage <= SourceFile::NameBound) {
return;
}
finishTypeChecking(TypeCheckOptions);
}
@@ -986,6 +992,7 @@ void CompilerInstance::parseAndTypeCheckMainFileUpTo(
llvm_unreachable("invalid limit stage");
case SourceFile::NameBound:
performNameBinding(MainFile, CurTUElem);
bindExtensions(MainFile);
break;
case SourceFile::TypeChecked:
const auto &options = Invocation.getFrontendOptions();