Minor changes for components related to wit-bindgen support (#5053)

* Plumb type exports in components around more

This commit adds some more plumbing for type exports to ensure that they
show up in the final compiled representation of a component. For now
they continued to be ignored for all purposes in the embedding API
itself but I found this useful to explore in `wit-bindgen` based tooling
which is leveraging the component parsing in Wasmtime.

* Add a field to `ModuleTranslation` to store the original wasm

This commit adds a field to be able to refer back to the original wasm
binary for a `ModuleTranslation`. This field is used in the upcoming
support for host generation in `wit-component` to "decompile" a
component into core wasm modules to get instantiated. This is used to
extract a core wasm module from the original component.

* FIx a build warning
This commit is contained in:
Alex Crichton
2022-10-13 12:11:34 -05:00
committed by GitHub
parent a2f846f124
commit ff0c45b4a0
6 changed files with 32 additions and 15 deletions

View File

@@ -152,6 +152,7 @@ pub enum Export {
ModuleStatic(StaticModuleIndex),
ModuleImport(RuntimeImportIndex),
Instance(IndexMap<String, Export>),
Type(TypeDef),
}
/// Same as `info::CoreDef`, except has an extra `Adapter` variant.
@@ -430,6 +431,7 @@ impl LinearizeDfg<'_> {
.map(|(name, export)| (name.clone(), self.export(export)))
.collect(),
),
Export::Type(def) => info::Export::Type(*def),
}
}