Skip to content

Commit 595a8e9

Browse files
docs(bindgen): add note about extra_resource_map hack
1 parent 7979fff commit 595a8e9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

crates/js-component-bindgen/src/transpile_bindgen.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3564,6 +3564,13 @@ impl<'a> Instantiator<'a, '_> {
35643564
_ => unreachable!("unexpected iface type"),
35653565
};
35663566
if let Some(elem_iface_ty) = maybe_elem_iface_ty {
3567+
// TODO(refactor): the last arg of `connect_resource_types()` (`extra_resource_map`) is
3568+
// necessary because we are not building the imports/exports array directly.
3569+
//
3570+
// It's a hack that *should* be removable if we do more explicit and intentional
3571+
// building of import/export resource mappings (i.e. not building a partial map that we
3572+
// later `.extend()` onto the instantiator's maps, depending on whether we were working on
3573+
// imports or exports).
35673574
self.connect_resource_types(*elem_ty_id, &elem_iface_ty, resource_map);
35683575
}
35693576

@@ -5519,7 +5526,7 @@ pub fn gen_flat_lower_fn_js_expr(
55195526
// If the resource was not imported (and came from the host), it comes from the component receiving it,
55205527
// and the object should already have a handle associated inside of it (the component must have created it).
55215528
//
5522-
// We disconnect the external conenctions for dispose and remove the external
5529+
// We disconnect the external connections for dispose and remove the external
55235530
// facing resource handle that was added when lifted out.
55245531
let empty_func = instantiator
55255532
.bindgen

0 commit comments

Comments
 (0)