-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Support ES6 Set/Map in stringifyWithFunctions #23678
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
Support ES6 Set/Map in stringifyWithFunctions #23678
Conversation
|
@sbc100 Could you help me create a test case? |
|
I suggest adding a new test to For example: |
|
could you suggest a name for the test case so that it matches the style and naming convention best? EDIT: I would like to add 2 test cases, one for successful run and one for failure because of non-empty. |
|
How about |
|
I am working on adding a test and I found this strange behavior: def test_jslib_new_objects_basic(self):
create_file('lib.js', '''
addToLibrary({
$obj: {
a: new Map(),
b: new Set(),
c: new WeakMap(),
d: new WeakSet(),
}
});
''')
self.run_process([EMCC, test_file('hello_world.c'), '--js-library=lib.js', '-sEXPORTED_FUNCTIONS=obj,_main'])I have this line in console.log(`##Debug ${inspect(obj)}, ${obj instanceof Set}, ${obj.size}`);And I get the following outputs: @sbc100 Did you have any tricks in jsifier.mjs? I cannot explain |
|
That could be related to the fact that we evaluate the library code in a separate JS context? See |
|
From reading https://nodejs.org/api/vm.html#what-does-it-mean-to-contextify-an-object it sounds like you may be able to add |
|
Thanks for working on this! |
|
The following test failure: From API history of Does emscripten uses lower version of this? |
|
@sbc100 do you want to update minimum node version requirement or revert this change to use |
The later please. Sorry for the back a forth on this :( |
51f0127 to
ebcb1ca
Compare
### Description Upgrade EMSDK to 4.0.4 ### Motivation and Context Emscripten v4.0.4 brings 2 useful changes that are helpful for webgpu: - emscripten-core/emscripten#23678 - emscripten-core/emscripten#23631
### Description Upgrade EMSDK to 4.0.4 ### Motivation and Context Emscripten v4.0.4 brings 2 useful changes that are helpful for webgpu: - emscripten-core/emscripten#23678 - emscripten-core/emscripten#23631
Fixes #23672