forked from bytecodealliance/wasm-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract "world elaboration" to a separate function (bytecodealliance…
…#1800) * Extract "world elaboration" to a separate function This commit extracts the process of elaborating a worlds imports/exports to a dedicated function. This function ensures the transitive closure of all imports/exports are listed in the world in proper topograhical order. This additionally validates that the world has a coherent definition given WIT today, notably that imports don't accidentally try to use exported types. This functionality was all present previously during the process of taking a WIT document and creating `Resolve`. This moves the logic around and refactors it slightly given its new surroundings. This reorders a few imports/exports in worlds from what was previously present but the underlying meaning of worlds should be the same. The goal of this commit is to enable `Resolve`-mutating transformations to not need to preserve all these invariants each time a world is modified. Instead a world can be modified and then this function can be called to "clean up" the world afterwards. * Simplify the `Resolve::importize` operation This commit updates the `importize` operation to be a much simpler "just move the exports to the imports" operation where care is only taken to preserve imported types and to additionally error on overlap of imported types and exported functions/interfaces. The previous `elaborate_world` method helps make this method much simpler than before.
- Loading branch information
1 parent
5a83828
commit e5132af
Showing
19 changed files
with
397 additions
and
455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
crates/wit-component/tests/interfaces/world-top-level.wit.print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.