You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support lists of WITs in Resolve::select_world (#2288)
* Support lists of WITs in `Resolve::select_world`
This extends `Resolve::select_world` to be usable for lists of WITs. One
such example is wit-bindgen's `generate` macro's `path:` parameter,
which can take a list of WIT paths. It currently uses a
[custom `select_world` implementation], but with this patch in wit-parser,
it would be able to use `Resolve::select_world` instead.
I'm also considering extending the wit-bindgen CLI to accept multiple WIT
paths; with this patch, it could use `Resolve::select_world` as well.
[custom `select_world` implementation]: https://github.com/bytecodealliance/wit-bindgen/blob/0e2201b8629b4144f45867161de7bc1fe26133bb/crates/guest-rust/macro/src/lib.rs#L191
Specifically, this PR makes the package argument to `Resolve::select_world`
an `Option`, and adds code to handle the case where it's `None`. A
`None` means the caller has a list of WITs and as such doesn't have a
single main package.
This also rewrites the documentation for `select_world` to clean up
already-obsolete references to the `packages` array argument, and to
hopefully make it more clear how `select_world` makes its choice.
* Remove debugging code.
* Make an error message about the main package call it the main package.
* Update test output for a new error message.
* Switch back to a list of main packages.
0 commit comments