Skip to content

Commit c195e3c

Browse files
committed
Reduce code duplication
1 parent 4c5c354 commit c195e3c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/core/js_dump.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,23 +1105,23 @@ and print_indented_list (f : P.t) (parent_expr_level : int) (cxt : cxt)
11051105
and print_jsx cxt ?(spread_props : J.expression option)
11061106
?(key : J.expression option) ~(level : int) f (fnName : string)
11071107
(tag : J.expression) (fields : (string * J.expression) list) : cxt =
1108+
let is_fragment =
1109+
match tag.expression_desc with
1110+
| J.Var (J.Qualified ({id = {name = "JsxRuntime"}}, Some "Fragment")) ->
1111+
true
1112+
| _ -> false
1113+
in
11081114
let print_tag cxt =
11091115
match tag.expression_desc with
11101116
(* "div" or any other primitive tag *)
11111117
| J.Str {txt} ->
11121118
P.string f txt;
11131119
cxt
11141120
(* fragment *)
1115-
| J.Var (J.Qualified ({id = {name = "JsxRuntime"}}, Some "Fragment")) -> cxt
1121+
| _ when is_fragment -> cxt
11161122
(* A user defined component or external component *)
11171123
| _ -> expression ~level cxt f tag
11181124
in
1119-
let is_fragment =
1120-
match tag.expression_desc with
1121-
| J.Var (J.Qualified ({id = {name = "JsxRuntime"}}, Some "Fragment")) ->
1122-
true
1123-
| _ -> false
1124-
in
11251125
let children_opt =
11261126
List.find_map
11271127
(fun (n, e) ->

0 commit comments

Comments
 (0)