mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Always mark the initial REPL file as typechecked
We were previously doing this for the REPL, but not for swift-ide-test. Move the assignment into the frontend to make sure its always applied, and inline `createREPLFile` while we're here.
This commit is contained in:
@@ -727,7 +727,15 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) {
|
||||
const ImplicitImports implicitImports(*this);
|
||||
|
||||
if (Invocation.getInputKind() == InputFileKind::SwiftREPL) {
|
||||
createREPLFile(implicitImports);
|
||||
// Create the initial empty REPL file. This only exists to feed in the
|
||||
// implicit imports such as the standard library.
|
||||
auto *replFile = createSourceFileForMainModule(
|
||||
SourceFileKind::REPL, implicitImports.kind, /*BufferID*/ None);
|
||||
addAdditionalInitialImportsTo(replFile, implicitImports);
|
||||
|
||||
// Given this file is empty, we can go ahead and just mark it as having been
|
||||
// type checked.
|
||||
replFile->ASTStage = SourceFile::TypeChecked;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -824,12 +832,6 @@ void CompilerInstance::getImplicitlyImportedModules(
|
||||
}
|
||||
}
|
||||
|
||||
void CompilerInstance::createREPLFile(const ImplicitImports &implicitImports) {
|
||||
auto *SingleInputFile = createSourceFileForMainModule(
|
||||
Invocation.getSourceFileKind(), implicitImports.kind, None);
|
||||
addAdditionalInitialImportsTo(SingleInputFile, implicitImports);
|
||||
}
|
||||
|
||||
void CompilerInstance::addMainFileToModule(
|
||||
const ImplicitImports &implicitImports) {
|
||||
auto *MainFile = createSourceFileForMainModule(
|
||||
|
||||
Reference in New Issue
Block a user