From f4e7c74ca0fe8e90bd0691b0907384b08cace0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Tue, 17 Sep 2024 11:14:25 +0200 Subject: [PATCH] JavaScript linker: add 'wasm' flag --- compiler/lib/linker.ml | 9 ++++++++- runtime/sys.js | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/lib/linker.ml b/compiler/lib/linker.ml index d9c93b3002..a49cd797d2 100644 --- a/compiler/lib/linker.ml +++ b/compiler/lib/linker.ml @@ -186,7 +186,14 @@ module Fragment = struct List.fold_left ~f:(fun m (k, v) -> StringMap.add k v m) ~init:StringMap.empty - [ "js-string", Config.Flag.use_js_string; "effects", Config.Flag.effects ] + [ "js-string", Config.Flag.use_js_string + ; "effects", Config.Flag.effects + ; ( "wasm" + , fun () -> + match Config.target () with + | `JavaScript -> false + | `Wasm -> true ) + ] type t = | Always_include of Javascript.program pack diff --git a/runtime/sys.js b/runtime/sys.js index 92c402bbd7..14f4c76241 100644 --- a/runtime/sys.js +++ b/runtime/sys.js @@ -357,6 +357,7 @@ function caml_sys_is_regular_file(name) { } //Always //Requires: caml_fatal_uncaught_exception +//If: !wasm function caml_setup_uncaught_exception_handler() { var process = globalThis.process; if(process && process.on) {