Skip to content

Commit a58f8c9

Browse files
committed
Support fragments
1 parent 99945f0 commit a58f8c9

File tree

1 file changed

+2
-49
lines changed

1 file changed

+2
-49
lines changed

compiler/core/js_dump.ml

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -996,60 +996,13 @@ and expression_desc cxt ~(level : int) f x : cxt =
996996
P.string f "...";
997997
expression ~level:13 cxt f e)
998998

999-
(*
1000-
(* match jsx_element with
1001-
| Parsetree.Jsx_fragment {jsx_fragment_children = children} ->
1002-
P.string f "<>";
1003-
(let children =
1004-
fields
1005-
|> List.find_map (fun (n, e) ->
1006-
if n = "children" then Some e else None)
1007-
in
1008-
children
1009-
|> Option.iter (fun c ->
1010-
P.string f "{";
1011-
let _ = expression ~level:1 cxt f c in
1012-
P.string f "}"));
1013-
P.string f "</>";
1014-
cxt
1015-
| Parsetree.Jsx_unary_element
1016-
{jsx_unary_element_tag_name = {txt = Longident.Lident tagName}} ->
1017-
Printf.eprintf "Crazy Tag: %s\n" tagName;
1018-
P.string f (Format.sprintf "<%s />" tagName);
1019-
cxt
1020-
| Parsetree.Jsx_container_element
1021-
{
1022-
jsx_container_element_tag_name_start =
1023-
{txt = Longident.Lident tagName};
1024-
} ->
1025-
P.string f (Format.sprintf "<%s" tagName);
1026-
List.iter
1027-
(fun (n, x) ->
1028-
P.space f;
1029-
P.string f n;
1030-
P.string f "=";
1031-
P.string f "{";
1032-
let _ = expression ~level:0 cxt f x in
1033-
P.string f "}")
1034-
fields;
1035-
P.string f "></";
1036-
P.string f tagName;
1037-
P.string f ">";
1038-
cxt *)
1039-
| _ ->
1040-
expression_desc cxt ~level f
1041-
(Call
1042-
( e,
1043-
el,
1044-
{call_transformed_jsx = None; arity = Full; call_info = Call_ml}
1045-
)))
1046-
*)
1047-
1048999
and print_jsx cxt ~(level : int) f (tag : J.expression)
10491000
(fields : (string * J.expression) list) : cxt =
10501001
let print_tag () =
10511002
match tag.expression_desc with
10521003
| J.Str {txt} -> P.string f txt
1004+
(* fragment *)
1005+
| J.Var (J.Qualified ({id = {name = "JsxRuntime"}}, Some "Fragment")) -> ()
10531006
| _ ->
10541007
let _ = expression ~level cxt f tag in
10551008
()

0 commit comments

Comments
 (0)