mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user