| 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( |