WebAssembly / binaryen

Optimizer and compiler/toolchain library for WebAssembly
Apache License 2.0
7.28k stars 717 forks source link

How to define parameter names? #5748

Open trusktr opened 1 year ago

trusktr commented 1 year ago

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.

kripken commented 1 year ago

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.

ericvergnaud commented 7 months ago

@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.