Refactor: improve testability by separating dependency discovery from frontend
Separate out finding and loading files of dependencies into
--> -->
main ---> Dependency Discovery --> Compiler --> CompilationUnit --> Backend
| --> --> |
v v
Reading Files Writing Files
The compiler should always receive a single file to compile and all compiled (typed, lowered, ...) dependencies. In consequence, it could in principle be parallelized to a certain degree. However, this refactoring is more important for reasoning and testing, than it is for performance.
Advantages
Processing the files in topological ordering of their dependencies would remove the dependency of Namer on Compiler.frontend. In consequence, Compiler and Context wouldn't need to be mutually recursive anymore.
Problem
If we use such an architecture, then we can't use the Task infrastructure anymore. At the moment, the frontend task itself invokes frontend on other files, which registers the dependency. Instead, the dependencies would need to be tracked manually by the driver (or, intelligence, or REPL).