Skip to content

Commit

Permalink
remove the duplicate into_handle
Browse files Browse the repository at this point in the history
  • Loading branch information
cpetig committed Apr 22, 2024
1 parent 685d5cc commit c408927
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/cpp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2941,7 +2941,7 @@ impl<'a, 'b> Bindgen for FunctionBindgen<'a, 'b> {
self.src.push_str(&format!(", ret, {})", cabi_post_name));
}
}
if matches!(func.kind, FunctionKind::Constructor(_)) {
if matches!(func.kind, FunctionKind::Constructor(_)) && guest_import {
// we wrapped the handle in an object, so unpack it
self.src.push_str(".into_handle()");
}
Expand Down
9 changes: 9 additions & 0 deletions crates/cpp/tests/native_resources/guest/the_world.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
// Generated by `wit-bindgen` 0.3.0. DO NOT EDIT!

// Ensure that the *_component_type.o object is linked in
#ifdef __wasm32__
extern void __component_type_object_force_link_the_world(void);
void __component_type_object_force_link_the_world_public_use_in_this_compilation_unit(
void) {
__component_type_object_force_link_the_world();
}
#endif
#include "the_world_cpp.h"
#include <cstdlib> // realloc

Expand Down

0 comments on commit c408927

Please sign in to comment.