| 291 | } |
| 292 | |
| 293 | fn lift_accessor( |
| 294 | &mut self, |
| 295 | item: &str, |
| 296 | lift_type_index: u32, |
| 297 | opts: &[wasm_encoder::CanonicalOption], |
| 298 | ) -> String { |
| 299 | let accessor_core_export_name = self.accessors.len().to_string(); |
| 300 | self.accessor_exports.export( |
| 301 | &accessor_core_export_name, |
| 302 | wasm_encoder::ExportKind::Func, |
| 303 | self.accessor_functions.len() - 1, |
| 304 | ); |
| 305 | |
| 306 | self.extra_aliases |
| 307 | .alias(wasm_encoder::Alias::CoreInstanceExport { |
| 308 | instance: self.accessor_instance_index(), |
| 309 | kind: wasm_encoder::ExportKind::Func, |
| 310 | name: &accessor_core_export_name, |
| 311 | }); |
| 312 | self.extra_core_funcs += 1; |
| 313 | self.extra_canonicals.lift( |
| 314 | self.component.core_funcs + self.extra_core_funcs - 1, |
| 315 | lift_type_index, |
| 316 | opts.iter().copied(), |
| 317 | ); |
| 318 | |
| 319 | let accessor_export_name = format!("{item}{}", self.accessors.len()); |
| 320 | self.accessor_instance_export_items.push(( |
| 321 | accessor_export_name.clone(), |
| 322 | wasm_encoder::ComponentExportKind::Func, |
| 323 | self.component.funcs + self.extra_canonicals.len() - 1, |
| 324 | )); |
| 325 | accessor_export_name |
| 326 | } |
| 327 | |
| 328 | fn finish(&mut self, encoder: &mut wasm_encoder::Component) { |
| 329 | // Build the `accessor_module` and add it to the component. |