binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

How to define parameter names?

Open trusktr opened this issue 2 years ago • 2 comments

Hello, new here. Does Binaryen output only unnamed "minified" code when it comes to things like parameters?

I see examples that do this only:

const params = binaryen.createType([i32, i32]) // no names, just number types
module.addFunction('foo', params, ...)

The TypeScript type definitions for binaryen.js are all just number (pointers I'd guess) with no docs, so hard to tell what to do.

trusktr avatar Jun 02 '23 07:06 trusktr

Binaryen itself does support the names section, which includes parameter types. But it looks like we don't have support for all those things in the C and JS APIs yet, so that would need adding.

kripken avatar Jun 02 '23 16:06 kripken

@trusktr you can however call setLocalName once the function is created. They don't show in the type, but they show in the function body.

ericvergnaud avatar Dec 04 '23 15:12 ericvergnaud