Skip to content

Commit 8b6a216

Browse files
committed
Add a warning when generating source maps if there is no debugging information
1 parent 0f7baaa commit 8b6a216

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

compiler/bin-wasm_of_ocaml/compile.ml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,20 @@ let run
262262
if times () then Format.eprintf " parsing js: %a@." Timer.print t1;
263263
if times () then Format.eprintf "Start parsing...@.";
264264
let need_debug = enable_source_maps || Config.Flag.debuginfo () in
265+
let check_debug (one : Parse_bytecode.one) =
266+
if (not runtime_only)
267+
&& enable_source_maps
268+
&& Parse_bytecode.Debug.is_empty one.debug
269+
&& not (Code.is_empty one.code)
270+
then
271+
warn
272+
"Warning: '--source-map' is enabled but the bytecode program was compiled with \
273+
no debugging information.\n\
274+
Warning: Consider passing '-g' option to ocamlc.\n\
275+
%!"
276+
in
265277
let output (one : Parse_bytecode.one) ~unit_name ch =
278+
check_debug one;
266279
let code = one.code in
267280
let standalone = Option.is_none unit_name in
268281
let live_vars, in_cps, p, debug =

0 commit comments

Comments
 (0)