From bc184d0c1db577dcf1ae53935527da38d011f0e9 Mon Sep 17 00:00:00 2001 From: Spotandjake Date: Sat, 13 Dec 2025 13:08:53 -0500 Subject: [PATCH 1/2] feat: Implement `BinaryenModuleUpdateMaps` in js api. This implements `BinaryenModuleUpdateMaps` as `module.update_maps()` in the js api. I might need some guidance on testing this. This is meant to be called after `setName` on a module in the c test suite it's called after `Table.setName` however I can't find any `setName` api's implemented in the js api so this might need to wait. I am trying to update this so we can make our bindings symmetrical between our js and c bindings in [`binaryen.ml`](https://github.com/grain-lang/binaryen.ml/issues/266) --- src/js/binaryen.js-post.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 0d851fe2b2b..c882b7d922f 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -2855,6 +2855,13 @@ function wrapModule(module, self = {}) { self['optimize'] = function() { return Module['_BinaryenModuleOptimize'](module); }; + /** + * Updates the internal name mapping logic in a module. This must be called + * after renaming module elements. + */ + self['update_maps'] = function() { + Module['_BinaryenModuleUpdateMaps'](module); + }; self['optimizeFunction'] = function(func) { if (typeof func === 'string') func = self['getFunction'](func); return Module['_BinaryenFunctionOptimize'](func, module); From 2f34a766d790f38a53c58bf54c70c18d96dc2402 Mon Sep 17 00:00:00 2001 From: Spotandjake Date: Mon, 15 Dec 2025 21:43:26 -0500 Subject: [PATCH 2/2] chore: Apply changes from code review --- src/js/binaryen.js-post.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index c882b7d922f..71ef1055725 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -2859,7 +2859,7 @@ function wrapModule(module, self = {}) { * Updates the internal name mapping logic in a module. This must be called * after renaming module elements. */ - self['update_maps'] = function() { + self['updateMaps'] = function() { Module['_BinaryenModuleUpdateMaps'](module); }; self['optimizeFunction'] = function(func) {