mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeCompletion] Avoid typechecking all toplevel decls in the current file
- Use `performParseAndResolveImportsOnly()` to invoke the frontend - Do `bindExtensions()` in `ide::typeCheckContextUntil()` - Typecheck preceding `TopLevelCodeDecl`s only if the compleiton is in a `TopLevelCodeDecl` - Other related tweaks rdar://problem/56636747
This commit is contained in:
@@ -845,8 +845,13 @@ void CompilerInstance::parseAndCheckTypesUpTo(
|
||||
|
||||
// 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) {
|
||||
@@ -870,10 +875,6 @@ void CompilerInstance::parseAndCheckTypesUpTo(
|
||||
}
|
||||
});
|
||||
|
||||
if (Invocation.isCodeCompletion()) {
|
||||
performCodeCompletionSecondPass(*PersistentState.get(),
|
||||
*Invocation.getCodeCompletionFactory());
|
||||
}
|
||||
finishTypeChecking(TypeCheckOptions);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user