MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / export

Method export

crates/environ/src/component/dfg.rs:776–816  ·  view source on GitHub ↗
(
        &mut self,
        export: &Export,
        items: &mut PrimaryMap<ExportIndex, info::Export>,
        wasmtime_types: &mut ComponentTypesBuilder,
        wasmparser_types: wasmparser::types

Source from the content-addressed store, hash-verified

774 }
775
776 fn export(
777 &mut self,
778 export: &Export,
779 items: &mut PrimaryMap<ExportIndex, info::Export>,
780 wasmtime_types: &mut ComponentTypesBuilder,
781 wasmparser_types: wasmparser::types::TypesRef<'_>,
782 ) -> Result<ExportIndex> {
783 let item = match export {
784 Export::LiftedFunction { ty, func, options } => {
785 let func = self.core_def(func);
786 let options = self.options(*options);
787 info::Export::LiftedFunction {
788 ty: *ty,
789 func,
790 options,
791 }
792 }
793 Export::ModuleStatic { ty, index } => info::Export::ModuleStatic {
794 ty: wasmtime_types.convert_module(wasmparser_types, *ty)?,
795 index: *index,
796 },
797 Export::ModuleImport { ty, import } => info::Export::ModuleImport {
798 ty: *ty,
799 import: *import,
800 },
801 Export::Instance { ty, exports } => info::Export::Instance {
802 ty: *ty,
803 exports: {
804 let mut map = NameMap::default();
805 for (name, (export, data)) in exports {
806 let export =
807 self.export(export, items, wasmtime_types, wasmparser_types)?;
808 map.insert(name, &mut NameMapNoIntern, false, (export, data.clone()))?;
809 }
810 map
811 },
812 },
813 Export::Type(def) => info::Export::Type(*def),
814 };
815 Ok(items.push(item))
816 }
817
818 fn options(&mut self, options: OptionsId) -> OptionsIndex {
819 self.intern_no_init(

Callers 2

encodeMethod · 0.45
finishMethod · 0.45

Calls 8

OkFunction · 0.85
convert_moduleMethod · 0.80
TypeEnum · 0.50
core_defMethod · 0.45
optionsMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected