mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 07:12:15 +00:00
[WebAssembly] wasm.js: use explicity variable for main_module (#43)
This commit is contained in:
parent
c93b284f39
commit
2b2b3bdbe3
@ -1471,19 +1471,19 @@ for (var i = arguments.length - 1; i > 0; --i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the main module once the ffi object has been fully populated.
|
// Load the main module once the ffi object has been fully populated.
|
||||||
var main_module = arguments[0];
|
var main_module_name = arguments[0];
|
||||||
modules[0] = load_wasm(main_module);
|
main_module = modules[0] = load_wasm(main_module_name);
|
||||||
heap_end = modules[0].exports.__heap_base;
|
heap_end = main_module.exports.__heap_base;
|
||||||
|
|
||||||
if (!(modules[0].exports.main instanceof Function))
|
if (!(main_module.exports.main instanceof Function))
|
||||||
throw new Error('main() not found');
|
throw new Error('main() not found');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (modules[0].exports.__wasm_call_ctors instanceof Function)
|
if (main_module.exports.__wasm_call_ctors instanceof Function)
|
||||||
modules[0].exports.__wasm_call_ctors();
|
main_module.exports.__wasm_call_ctors();
|
||||||
var ret = modules[0].exports.main();
|
var ret = main_module.exports.main();
|
||||||
stdio.__flush_stdout();
|
stdio.__flush_stdout();
|
||||||
print(main_module + '::main() returned ' + ret);
|
print(main_module_name + '::main() returned ' + ret);
|
||||||
if (ret != stdlib.EXIT_SUCCESS)
|
if (ret != stdlib.EXIT_SUCCESS)
|
||||||
throw new Error('main reported failure');
|
throw new Error('main reported failure');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user