emscripten-core / emscripten-core/emscripten

Named arguments(destructuring assignment) do not work for library functions

Open
#22,271 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

The following example doesn't work. We'll need to update the regex for arrow functions [here](https://github.com/emscripten-core/emscripten/blob/d6f18aee98d183bde8210029975d68cae54a74c4/src/jsifier.mjs#L601) to support this.

```js
addToLibrary({
$zzz: ({num}) => {
console.log(num);
},
hello_world__deps: ['$zzz'],
hello_world: (num) => {
zzz({num});
}
});
```

```c
#include
#include

extern void hello_world(int);

int main() {
hello_world(99);
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.