Skip to content

Commit e4fd4a4

Browse files
Simplify jsoo once more
1 parent 65eb326 commit e4fd4a4

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

compiler/jsoo/jsoo_playground_main.ml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -520,18 +520,6 @@ module Compile = struct
520520
in
521521
typed_tree |> Translmod.transl_implementation modulename
522522
|> fun (lambda, exports) ->
523-
let debug_outputs =
524-
if include_debug_outputs then
525-
let export_ident_sets = Set_ident.of_list exports in
526-
let lam, _ = Lam_convert.convert export_ident_sets lambda in
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 )
533-
else None
534-
in
535523
let buffer = Buffer.create 1000 in
536524
let () =
537525
Js_dump_program.pp_deps_program ~output_prefix:""
@@ -554,19 +542,26 @@ module Compile = struct
554542
("type", inject @@ Js.string "success");
555543
|]
556544
in
557-
let debug_attrs =
558-
match debug_outputs with
559-
| Some (parsetree, typedtree, lambda, lam) ->
545+
if include_debug_outputs then
546+
let export_ident_sets = Set_ident.of_list exports in
547+
let lam, _ = Lam_convert.convert export_ident_sets lambda in
548+
let parsetree = Printer.to_string Printast.implementation ast in
549+
let typedtree =
550+
Printer.to_string Printtyped.implementation_with_coercion typed_tree
551+
in
552+
let lambda = Printer.to_string Printlambda.lambda lambda in
553+
let lam = Lam_print.lambda_to_string lam in
554+
let debug_attrs =
560555
Js.Unsafe.
561556
[|
562557
("parsetree", inject @@ Js.string parsetree);
563558
("typedtree", inject @@ Js.string typedtree);
564559
("lambda", inject @@ Js.string lambda);
565560
("lam", inject @@ Js.string lam);
566561
|]
567-
| None -> [||]
568-
in
569-
Js.Unsafe.(obj (Array.append attrs debug_attrs))
562+
in
563+
Js.Unsafe.obj (Array.append attrs debug_attrs)
564+
else Js.Unsafe.obj attrs
570565
with e -> (
571566
match e with
572567
| Arg.Bad msg -> ErrorRet.make_warning_flag_error ~warn_flags msg

0 commit comments

Comments
 (0)