Skip to content

[embind] Autogen EM_METHOD_CALLER_KIND bindings. NFC #24521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/libemval.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ var LibraryEmVal = {

var offset = 0;
var argsList = []; // 'obj?, arg0, arg1, arg2, ... , argN'
if (kind === /* FUNCTION */ 0) {
if (kind === {{{ cDefs['internal::EM_METHOD_CALLER_KIND::FUNCTION'] }}}) {
argsList.push('obj');
}
var params = ['retType'];
Expand All @@ -344,7 +344,7 @@ var LibraryEmVal = {
` var arg${i} = argType${i}.readValueFromPointer(args${offset ? '+' + offset : ''});\n`;
offset += types[i].argPackAdvance;
}
var invoker = kind === /* CONSTRUCTOR */ 1 ? 'new func' : 'func.call';
var invoker = kind === {{{ cDefs['internal::EM_METHOD_CALLER_KIND::CONSTRUCTOR'] }}} ? 'new func' : 'func.call';
functionBody +=
` var rv = ${invoker}(${argsList.join(', ')});\n`;
if (!retType.isVoid) {
Expand Down
8 changes: 8 additions & 0 deletions src/struct_info_cxx.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,13 @@
"wasmfs::File::DirectoryKind",
"wasmfs::File::SymlinkKind"
]
},
// Embind
{
"file": "emscripten/val.h",
"defines": [
"emscripten::internal::EM_METHOD_CALLER_KIND::FUNCTION",
"emscripten::internal::EM_METHOD_CALLER_KIND::CONSTRUCTOR"
]
}
]
4 changes: 3 additions & 1 deletion src/struct_info_generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,9 @@
"__WASI_RIGHTS_PATH_SYMLINK": 16777216,
"__WASI_RIGHTS_PATH_UNLINK_FILE": 67108864,
"__WASI_RIGHTS_POLL_FD_READWRITE": 134217728,
"__WASI_RIGHTS_SOCK_SHUTDOWN": 268435456
"__WASI_RIGHTS_SOCK_SHUTDOWN": 268435456,
"internal::EM_METHOD_CALLER_KIND::CONSTRUCTOR": 1,
"internal::EM_METHOD_CALLER_KIND::FUNCTION": 0
},
"structs": {
"AudioParamFrame": {
Expand Down
4 changes: 3 additions & 1 deletion src/struct_info_generated_wasm64.json
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,9 @@
"__WASI_RIGHTS_PATH_SYMLINK": 16777216,
"__WASI_RIGHTS_PATH_UNLINK_FILE": 67108864,
"__WASI_RIGHTS_POLL_FD_READWRITE": 134217728,
"__WASI_RIGHTS_SOCK_SHUTDOWN": 268435456
"__WASI_RIGHTS_SOCK_SHUTDOWN": 268435456,
"internal::EM_METHOD_CALLER_KIND::CONSTRUCTOR": 1,
"internal::EM_METHOD_CALLER_KIND::FUNCTION": 0
},
"structs": {
"AudioParamFrame": {
Expand Down