Use module.exports to get the entry function name in WASM test lib

Obtaining entry function name with exports = {} is about to get removed
(in emscripten 3.1.44). Use the only alternative, which is to specify
the module = {} object that gets the 'exports' variable. Oddly enough,
it gets assigned the only export name, even though the name is plural.

Change-Id: Idcda29bfcaed2d0a923a8d39af078359abc73f7d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Mikolaj Boc 2023-07-31 14:56:52 +02:00
parent 63b64084cd
commit 592494e2e5

View File

@ -109,18 +109,19 @@ export class CompiledModule {
this.#resourceLocator = resourceLocator;
}
static make(js, wasm, entryFunctionName, resourceLocator
) {
static make(js, wasm, entryFunctionName, resourceLocator)
{
const exports = {};
const module = {};
eval(js);
if (!exports[entryFunctionName]) {
if (!module.exports) {
throw new Error(
'${entryFunctionName} has not been exported by the main script'
);
}
return new CompiledModule(
exports[entryFunctionName], js, wasm, resourceLocator
module.exports, js, wasm, resourceLocator
);
}