File tree 3 files changed +9
-15
lines changed
3 files changed +9
-15
lines changed Original file line number Diff line number Diff line change @@ -246,23 +246,14 @@ let generate_prelude ~out_file =
246
246
~deadcode_sentinal
247
247
program
248
248
in
249
- Generate. output ch ~context ;
249
+ Generate. wasm_output ch ~context ;
250
250
uinfo.provides
251
251
252
252
let build_prelude z =
253
253
Fs. with_intermediate_file (Filename. temp_file " prelude" " .wasm" )
254
254
@@ fun prelude_file ->
255
- Fs. with_intermediate_file (Filename. temp_file " prelude_file" " .wasm" )
256
- @@ fun tmp_prelude_file ->
257
255
let predefined_exceptions = generate_prelude ~out_file: prelude_file in
258
- Binaryen. optimize
259
- ~profile: Profile. O1
260
- ~input_file: prelude_file
261
- ~output_file: tmp_prelude_file
262
- ~opt_input_sourcemap: None
263
- ~opt_output_sourcemap: None
264
- () ;
265
- Zip. add_file z ~name: " prelude.wasm" ~file: tmp_prelude_file;
256
+ Zip. add_file z ~name: " prelude.wasm" ~file: prelude_file;
266
257
predefined_exceptions
267
258
268
259
let build_js_runtime ~primitives ?runtime_arguments () =
@@ -408,7 +399,7 @@ let run
408
399
program
409
400
in
410
401
if standalone then Generate. add_start_function ~context toplevel_name;
411
- Generate. output ch ~context ;
402
+ Generate. output ch ~enable_source_maps ~ context ;
412
403
if times () then Format. eprintf " compilation: %a@." Timer. print t;
413
404
generated_js
414
405
in
Original file line number Diff line number Diff line change @@ -1315,10 +1315,12 @@ let add_start_function = G.add_start_function
1315
1315
1316
1316
let add_init_function = G. add_init_function
1317
1317
1318
- let output ch ~context =
1318
+ let output ch ~enable_source_maps ~ context =
1319
1319
let t = Timer. make () in
1320
1320
let fields = G. output ~context in
1321
- Wat_output. f ch fields;
1321
+ if enable_source_maps || Debug. find " wat" ()
1322
+ then Wat_output. f ch fields
1323
+ else Wasm_output. f ch fields;
1322
1324
if times () then Format. eprintf " output: %a@." Timer. print t
1323
1325
1324
1326
let wasm_output ch ~context =
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ val add_start_function : context:Code_generation.context -> Wasm_ast.var -> unit
33
33
34
34
val add_init_function : context :Code_generation .context -> to_link :string list -> unit
35
35
36
- val output : out_channel -> context :Code_generation .context -> unit
36
+ val output :
37
+ out_channel -> enable_source_maps :bool -> context :Code_generation .context -> unit
37
38
38
39
val wasm_output : out_channel -> context :Code_generation .context -> unit
You can’t perform that action at this time.
0 commit comments