@@ -145,7 +145,6 @@ module InExternal = struct
145145 let status = ref false
146146end
147147
148- (* let jsx_attr = (Location.mknoloc "JSX", Parsetree.PStr []) *)
149148let ternary_attr = (Location. mknoloc " res.ternary" , Parsetree. PStr [] )
150149let if_let_attr = (Location. mknoloc " res.iflet" , Parsetree. PStr [] )
151150let make_await_attr loc = (Location. mkloc " res.await" loc, Parsetree. PStr [] )
@@ -2598,11 +2597,7 @@ and parse_jsx_opening_or_self_closing_element ~start_pos p :
25982597 Parser. expect GreaterThan p;
25992598 let loc = mk_loc jsx_start_pos p.Parser. start_pos in
26002599 (* Ast_helper.Exp.make_list_expression loc [] None no children *)
2601- let desc =
2602- Parsetree. Pexp_jsx_unary_element
2603- {jsx_unary_element_tag_name = name; jsx_unary_element_props = jsx_props}
2604- in
2605- {pexp_desc = desc; pexp_loc = loc; pexp_attributes = [] }
2600+ Ast_helper.Exp. jsx_unary_element ~loc name jsx_props
26062601 | GreaterThan -> (
26072602 (* <foo a=b> bar </foo> *)
26082603 (* let children_start_pos = p.Parser.start_pos in *)
@@ -2623,15 +2618,7 @@ and parse_jsx_opening_or_self_closing_element ~start_pos p :
26232618 Scanner. pop_mode p.scanner Jsx ;
26242619 Parser. expect GreaterThan p;
26252620 let loc = mk_loc jsx_start_pos p.Parser. start_pos in
2626- let desc =
2627- Parsetree. Pexp_jsx_container_element
2628- {
2629- jsx_container_element_tag_name_start = name;
2630- jsx_container_element_props = jsx_props;
2631- jsx_container_element_children = children;
2632- }
2633- in
2634- {pexp_desc = desc; pexp_loc = loc; pexp_attributes = [] }
2621+ Ast_helper.Exp. jsx_container_element ~loc name jsx_props children
26352622 (* let loc = mk_loc children_start_pos children_end_pos in
26362623 match (spread, children) with
26372624 | true, child :: _ -> child
@@ -2653,12 +2640,17 @@ and parse_jsx_opening_or_self_closing_element ~start_pos p :
26532640 (Diagnostics. message msg);
26542641 Parser. expect GreaterThan p
26552642 in
2656- Ast_helper.Exp. make_list_expression (mk_loc p.start_pos p.end_pos) [] None
2643+ Ast_helper.Exp. jsx_container_element
2644+ ~loc: (mk_loc jsx_start_pos p.end_pos)
2645+ name jsx_props children
2646+ (* Ast_helper.Exp.make_list_expression (mk_loc p.start_pos p.end_pos) [] None *)
26572647 )
26582648 | token ->
26592649 Scanner. pop_mode p.scanner Jsx ;
26602650 Parser. err p (Diagnostics. unexpected token p.breadcrumbs);
2661- Ast_helper.Exp. make_list_expression Location. none [] None
2651+ Ast_helper.Exp. jsx_unary_element
2652+ ~loc: (mk_loc jsx_start_pos p.end_pos)
2653+ name jsx_props
26622654
26632655(* and parse_jsx_opening_or_self_closing_element_old ~start_pos p =
26642656 let jsx_start_pos = p.Parser.start_pos in
0 commit comments