File tree Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Expand file tree Collapse file tree 3 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -653,8 +653,6 @@ class CompilerInstance {
653
653
};
654
654
655
655
private:
656
- void createREPLFile (const ImplicitImports &implicitImports);
657
-
658
656
void addMainFileToModule (const ImplicitImports &implicitImports);
659
657
660
658
void performSemaUpTo (SourceFile::ASTStage_t LimitStage);
Original file line number Diff line number Diff line change @@ -727,7 +727,15 @@ void CompilerInstance::performSemaUpTo(SourceFile::ASTStage_t LimitStage) {
727
727
const ImplicitImports implicitImports (*this );
728
728
729
729
if (Invocation.getInputKind () == InputFileKind::SwiftREPL) {
730
- createREPLFile (implicitImports);
730
+ // Create the initial empty REPL file. This only exists to feed in the
731
+ // implicit imports such as the standard library.
732
+ auto *replFile = createSourceFileForMainModule (
733
+ SourceFileKind::REPL, implicitImports.kind , /* BufferID*/ None);
734
+ addAdditionalInitialImportsTo (replFile, implicitImports);
735
+
736
+ // Given this file is empty, we can go ahead and just mark it as having been
737
+ // type checked.
738
+ replFile->ASTStage = SourceFile::TypeChecked;
731
739
return ;
732
740
}
733
741
@@ -824,12 +832,6 @@ void CompilerInstance::getImplicitlyImportedModules(
824
832
}
825
833
}
826
834
827
- void CompilerInstance::createREPLFile (const ImplicitImports &implicitImports) {
828
- auto *SingleInputFile = createSourceFileForMainModule (
829
- Invocation.getSourceFileKind (), implicitImports.kind , None);
830
- addAdditionalInitialImportsTo (SingleInputFile, implicitImports);
831
- }
832
-
833
835
void CompilerInstance::addMainFileToModule (
834
836
const ImplicitImports &implicitImports) {
835
837
auto *MainFile = createSourceFileForMainModule (
Original file line number Diff line number Diff line change @@ -997,10 +997,6 @@ class REPLEnvironment {
997
997
IRGenOpts.DebugInfoLevel = IRGenDebugInfoLevel::None;
998
998
IRGenOpts.DebugInfoFormat = IRGenDebugInfoFormat::None;
999
999
1000
- // The very first module is a dummy.
1001
- CI.getMainModule ()->getMainSourceFile (SourceFileKind::REPL).ASTStage =
1002
- SourceFile::TypeChecked;
1003
-
1004
1000
if (!ParseStdlib) {
1005
1001
// Force standard library to be loaded immediately. This forces any
1006
1002
// errors to appear upfront, and helps eliminate some nasty lag after the
You can’t perform that action at this time.
0 commit comments