@@ -717,13 +717,37 @@ module SexpAst = struct
717717 [
718718 Sexp. atom " Pexp_jsx_fragment" ; Sexp. list (map_empty ~f: expression xs);
719719 ]
720- | Pexp_jsx_unary_element _ ->
721- failwith " Pexp_jsx_unary_element is not supported"
722- | Pexp_jsx_container_element _ ->
723- failwith " Pexp_jsx_container_element is not supported"
720+ | Pexp_jsx_unary_element {jsx_unary_element_props = props } ->
721+ Sexp. list
722+ [
723+ Sexp. atom " Pexp_jsx_unary_element" ;
724+ Sexp. list (map_empty ~f: jsx_prop props);
725+ ]
726+ | Pexp_jsx_container_element
727+ {
728+ jsx_container_element_props = props;
729+ jsx_container_element_children = children;
730+ } ->
731+ let xs =
732+ match children with
733+ | JSXChildrenSpreading e -> [e]
734+ | JSXChildrenItems xs -> xs
735+ in
736+ Sexp. list
737+ [
738+ Sexp. atom " Pexp_jsx_container_element" ;
739+ Sexp. list (map_empty ~f: jsx_prop props);
740+ Sexp. list (map_empty ~f: expression xs);
741+ ]
724742 in
725743 Sexp. list [Sexp. atom " expression" ; desc]
726744
745+ and jsx_prop = function
746+ | JSXPropPunning (_ , name ) -> Sexp. atom name.txt
747+ | JSXPropValue (name , _ , expr ) ->
748+ Sexp. list [Sexp. atom name.txt; expression expr]
749+ | JSXPropSpreading (_ , expr ) -> expression expr
750+
727751 and case c =
728752 Sexp. list
729753 [
0 commit comments