@@ -509,11 +509,6 @@ module Compile = struct
509509 (* default *)
510510 let ast = impl str in
511511 let ast = Ppx_entry. rewrite_implementation ast in
512- let debug_parsetree =
513- if include_debug_outputs then
514- Some (Printer. to_string Printast. implementation ast)
515- else None
516- in
517512 let typed_tree =
518513 let a, b, _, signature =
519514 Typemod. type_implementation_more modulename modulename modulename env
@@ -523,25 +518,18 @@ module Compile = struct
523518 types_signature := signature;
524519 (a, b)
525520 in
526- let debug_typedtree =
527- if include_debug_outputs then
528- Some
529- (Printer. to_string Printtyped. implementation_with_coercion
530- typed_tree)
531- else None
532- in
533521 typed_tree |> Translmod. transl_implementation modulename
534522 |> fun (lambda , exports ) ->
535- let debug_lambda =
536- if include_debug_outputs then
537- Some (Printer. to_string Printlambda. lambda lambda)
538- else None
539- in
540- let debug_lam =
523+ let debug_outputs =
541524 if include_debug_outputs then
542525 let export_ident_sets = Set_ident. of_list exports in
543526 let lam, _ = Lam_convert. convert export_ident_sets lambda in
544- Some (Lam_print. lambda_to_string lam)
527+ Some
528+ ( Printer. to_string Printast. implementation ast,
529+ Printer. to_string Printtyped. implementation_with_coercion
530+ typed_tree,
531+ Printer. to_string Printlambda. lambda lambda,
532+ Lam_print. lambda_to_string lam )
545533 else None
546534 in
547535 let buffer = Buffer. create 1000 in
@@ -567,16 +555,16 @@ module Compile = struct
567555 |]
568556 in
569557 let debug_attrs =
570- match (debug_parsetree, debug_typedtree, debug_lambda, debug_lam) with
571- | Some parsetree , Some typedtree , Some lambda , Some lam ->
558+ match debug_outputs with
559+ | Some ( parsetree , typedtree , lambda , lam ) ->
572560 Js.Unsafe.
573561 [|
574562 (" parsetree" , inject @@ Js. string parsetree);
575563 (" typedtree" , inject @@ Js. string typedtree);
576564 (" lambda" , inject @@ Js. string lambda);
577565 (" lam" , inject @@ Js. string lam);
578566 |]
579- | _ -> [||]
567+ | None -> [||]
580568 in
581569 Js.Unsafe. (obj (Array. append attrs debug_attrs))
582570 with e -> (
0 commit comments