Load and can new top-level imports

Previously, all imports were available in the header, so we could start
processing dependencies as soon as we parsed it. However, the new imports
are treated as defs, so we have to parse the whole module to find them.

This commit essentially moves the dependency resolution from the `LoadHeader`
phase to the `Parse` phase, and it updates canonicalization to introduce
module symbols into scope when a `ValueDef::ModuleImport` is encountered.

NOTE:
- The `imports` header still parses, but it's no longer wired up. I will remove
it in an upcoming commit.
- Ingested files and imports that appear in nested expressions are not
yet supported by load
This commit is contained in:
Agus Zubiaga 2023-12-29 15:36:31 -03:00
parent 11e0202eb9
commit 710d62f754
No known key found for this signature in database
43 changed files with 683 additions and 771 deletions

View file

@ -251,6 +251,12 @@ fn generate_entry_docs(
ValueDef::ExpectFx { .. } => {
// Don't generate docs for `expect-fx`s
}
ValueDef::ModuleImport { .. } => {
// Don't generate docs for module imports
}
ValueDef::IngestedFileImport { .. } => {
// Don't generate docs for ingested file imports
}
},
Ok(type_index) => match &defs.type_defs[type_index.index()] {
TypeDef::Alias {