diff --git a/src/embind/embind.js b/src/embind/embind.js index 137a0fdef3cbd..9cb5007fa2752 100644 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -408,6 +408,7 @@ var LibraryEmbind = { }, #if WASM_BIGINT + _embind_register_bigint__docs: '/** @suppress {globalThis} */', _embind_register_bigint__deps: [ '$embindRepr', '$readLatin1String', '$registerType', '$integerReadValueFromPointer'], _embind_register_bigint: (primitiveType, name, size, minRange, maxRange) => { diff --git a/test/core/embind_lib_with_asyncify.test.js b/test/core/embind_lib_with_asyncify.test.js index 3deae012e790d..9e11f4cc5d485 100644 --- a/test/core/embind_lib_with_asyncify.test.js +++ b/test/core/embind_lib_with_asyncify.test.js @@ -1,19 +1,19 @@ -Module.onRuntimeInitialized = async () => { +Module['onRuntimeInitialized'] = async () => { try { - let delayedThrowResult = Module.delayed_throw(); + let delayedThrowResult = Module["delayed_throw"](); assert(delayedThrowResult instanceof Promise); let err = await delayedThrowResult.then(() => '', err => err.message); assert(err === 'my message', `"${err}" doesn't contain the expected error`); - let fooResult = Module.foo(); + let fooResult = Module["foo"](); assert(fooResult instanceof Promise); fooResult = await fooResult; assert(fooResult === 10); - let barInstancePromise = new Module.Bar(); + let barInstancePromise = new Module["Bar"](); assert(barInstancePromise instanceof Promise); let barInstance = await barInstancePromise; - assert(barInstance instanceof Module.Bar); + assert(barInstance instanceof Module["Bar"]); assert(barInstance.x === 20); let barMethodResult = barInstance.method(); @@ -27,7 +27,7 @@ Module.onRuntimeInitialized = async () => { assert(barMethodResult instanceof Promise); assert(await barMethodResult === undefined); - let barStaticMethodResult = Module.Bar.static_method(); + let barStaticMethodResult = Module["Bar"].static_method(); assert(barStaticMethodResult instanceof Promise); assert(await barStaticMethodResult === 50); diff --git a/test/core/test_embind_5.cpp b/test/core/test_embind_5.cpp index 291e4a4cff0b0..382985a61e971 100644 --- a/test/core/test_embind_5.cpp +++ b/test/core/test_embind_5.cpp @@ -51,10 +51,10 @@ EMSCRIPTEN_BINDINGS(my_module) { int main(int argc, char **argv) { EM_ASM( try { - var foo = new Module.MyFoo(); - foo.doit(); - var bar = new Module.MyBar(); - bar.doit(); + var foo = new Module['MyFoo'](); + foo['doit'](); + var bar = new Module['MyBar'](); + bar['doit'](); } catch(e) { out(e); } finally { diff --git a/test/core/test_embind_polymorphic_class_no_rtti.cpp b/test/core/test_embind_polymorphic_class_no_rtti.cpp index f2fa4e2971f4b..ba33909febf32 100644 --- a/test/core/test_embind_polymorphic_class_no_rtti.cpp +++ b/test/core/test_embind_polymorphic_class_no_rtti.cpp @@ -9,7 +9,7 @@ #include EM_JS(void, calltest, (), { - var foo = new Module.Foo(); + var foo = new Module["Foo"](); console.log("foo.test() returned: " + foo.test()); foo.delete(); }); diff --git a/test/embind/test_custom_marshal.js b/test/embind/test_custom_marshal.js index c53c65263952e..c4a27331bb780 100644 --- a/test/embind/test_custom_marshal.js +++ b/test/embind/test_custom_marshal.js @@ -1,4 +1,4 @@ -Module.js_func = function(x) { +Module['js_func'] = function(x) { console.log('JS got', x, typeof(x)); return 20; } diff --git a/test/embind/test_finalization.js b/test/embind/test_finalization.js index e2c0257e9cac6..03e964716265b 100644 --- a/test/embind/test_finalization.js +++ b/test/embind/test_finalization.js @@ -1,6 +1,6 @@ Module.onRuntimeInitialized = () => { - const foo1 = new Module.Foo("Constructed from JS"); - const foo2 = Module.foo(); - const foo3 = Module.pFoo(); + const foo1 = new Module["Foo"]("Constructed from JS"); + const foo2 = Module["foo"](); + const foo3 = Module["pFoo"](); setTimeout(gc, 100); } diff --git a/test/embind/test_i64_val.cpp b/test/embind/test_i64_val.cpp index 1b33256b7814c..ebec5ecee6b10 100644 --- a/test/embind/test_i64_val.cpp +++ b/test/embind/test_i64_val.cpp @@ -41,6 +41,7 @@ int main() { std::array int64Array = {-2, -1, 0, 1, 2}; printf("start\n"); + EM_ASM({globalThis.a = null}); test("val(int64_t v)"); val::global().set("a", val(int64_t(1234))); diff --git a/test/test_core.py b/test/test_core.py index 22ed1b3c67225..744adb99a15ba 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -7637,10 +7637,11 @@ def test_embind(self, args): }) @node_pthreads def test_embind_2(self, args): + self.maybe_closure() self.emcc_args += ['-lembind', '--post-js', 'post.js'] + args create_file('post.js', ''' function printLerp() { - out('lerp ' + Module.lerp(100, 200, 66) + '.'); + out('lerp ' + Module['lerp'](100, 200, 66) + '.'); } ''') create_file('test_embind_2.cpp', r''' @@ -7668,7 +7669,7 @@ def test_embind_3(self): create_file('post.js', ''' function ready() { try { - Module.compute(new Uint8Array([1,2,3])); + Module['compute'](new Uint8Array([1,2,3])); } catch(e) { out(e); } @@ -7695,7 +7696,7 @@ def test_embind_4(self): self.emcc_args += ['-lembind', '--post-js', 'post.js'] create_file('post.js', ''' function printFirstElement() { - out(Module.getBufferView()[0]); + out(Module['getBufferView']()[0]); } ''') create_file('test_embind_4.cpp', r''' @@ -7779,7 +7780,7 @@ def test_embind_no_rtti(self): #include EM_JS(void, calltest, (), { - out("dotest returned: " + Module.dotest()); + out("dotest returned: " + Module["dotest"]()); }); int main(int argc, char** argv){ @@ -7811,7 +7812,7 @@ def test_embind_no_rtti_followed_by_rtti(self): #include EM_JS(void, calltest, (), { - out("dotest returned: " + Module.dotest()); + out("dotest returned: " + Module["dotest"]()); }); int main(int argc, char** argv){