Rework the integrated REPL to use separate modules for every line

...like LLDB does, instead of parsing into a single SourceFile.
This does break some functionality:

- no more :dump_ast
- no redeclaration checking, but no shadowing either---redeclarations
  just become ambiguous
- pretty much requires EnableAccessControl to be off, since we don't
  walk decls to promote them to 'public'

...but it allows us to remove a bit of longstanding support for
type-checking / SILGen-ing / IRGen-ing only part of a SourceFile that
was only used by the integrated REPL.

...which, need I remind everyone, is still /deprecated/...but sometimes
convenient. So most of it still works.
This commit is contained in:
Jordan Rose
2018-09-22 00:16:01 -07:00
parent f1856b8f47
commit 2b5a2ad84c
5 changed files with 97 additions and 94 deletions

View File

@@ -1305,6 +1305,12 @@ SourceFile::collectLinkLibraries(ModuleDecl::LinkLibraryCallback callback) const
if (next->getName() == getParentModule()->getName())
return true;
// Hack: Assume other REPL files already have their libraries linked.
if (!next->getFiles().empty())
if (auto *nextSource = dyn_cast<SourceFile>(next->getFiles().front()))
if (nextSource->Kind == SourceFileKind::REPL)
return true;
next->collectLinkLibraries(callback);
return true;
});