@@ -1397,67 +1397,21 @@ and walk_expression expr t comments =
13971397        walk_expression call_expr t inside;
13981398        after)
13991399    in 
1400-     if  ParsetreeViewer. is_jsx_expression expr then  (
1401-       let  props = 
1402-         arguments
1403-         |>  List. filter (fun  (label , _ ) ->
1404-                match  label with 
1405-                |  Asttypes. Labelled  {txt  = "children" }  -> false 
1406-                |  Asttypes. Nolabel  -> false 
1407-                |  _  -> true )
1408-       in 
1409-       let  maybe_children = 
1410-         arguments
1411-         |>  List. find_opt (fun  (label , _ ) ->
1412-                match  label with 
1413-                |  Asttypes. Labelled  {txt  = "children" }  -> true 
1414-                |  _  -> false )
1415-       in 
1416-       match  maybe_children with 
1417-       (*  There is no need to deal with this situation as the children cannot be NONE *) 
1418-       |  None  -> () 
1419-       |  Some  (_ , children ) ->
1420-         let  leading, inside, _ =  partition_by_loc after children.pexp_loc in 
1421-         if  props =  []  then 
1422-           (*  All comments inside a tag are trailing comments of the tag if there are no props
1423-              <A 
1424-              // comment 
1425-              // comment 
1426-              /> 
1427-           *)  
1428-           let  after_expr, _ = 
1429-             partition_adjacent_trailing call_expr.pexp_loc after
1430-           in 
1431-           attach t.trailing call_expr.pexp_loc after_expr
1432-         else 
1433-           walk_list
1434-             (props
1435-             |>  List. map (fun  (lbl , expr ) ->
1436-                    let  loc = 
1437-                      match  lbl with 
1438-                      |  Asttypes. Labelled  {loc}  |  Optional  {loc}  ->
1439-                        {loc with  loc_end =  expr.Parsetree. pexp_loc.loc_end}
1440-                      |  _  -> expr.pexp_loc
1441-                    in 
1442-                    ExprArgument  {expr; loc}))
1443-             t leading;
1444-         walk_expression children t inside)
1445-     else 
1446-       let  after_expr, rest = 
1447-         partition_adjacent_trailing call_expr.pexp_loc after
1448-       in 
1449-       attach t.trailing call_expr.pexp_loc after_expr;
1450-       walk_list
1451-         (arguments
1452-         |>  List. map (fun  (lbl , expr ) ->
1453-                let  loc = 
1454-                  match  lbl with 
1455-                  |  Asttypes. Labelled  {loc}  |  Optional  {loc}  ->
1456-                    {loc with  loc_end =  expr.Parsetree. pexp_loc.loc_end}
1457-                  |  _  -> expr.pexp_loc
1458-                in 
1459-                ExprArgument  {expr; loc}))
1460-         t rest
1400+     let  after_expr, rest = 
1401+       partition_adjacent_trailing call_expr.pexp_loc after
1402+     in 
1403+     attach t.trailing call_expr.pexp_loc after_expr;
1404+     walk_list
1405+       (arguments
1406+       |>  List. map (fun  (lbl , expr ) ->
1407+              let  loc = 
1408+                match  lbl with 
1409+                |  Asttypes. Labelled  {loc}  |  Optional  {loc}  ->
1410+                  {loc with  loc_end =  expr.Parsetree. pexp_loc.loc_end}
1411+                |  _  -> expr.pexp_loc
1412+              in 
1413+              ExprArgument  {expr; loc}))
1414+       t rest
14611415  |  Pexp_fun  _  |  Pexp_newtype  _  -> (
14621416    let  _, parameters, return_expr =  fun_expr expr in 
14631417    let  comments = 
@@ -1518,8 +1472,24 @@ and walk_expression expr t comments =
15181472    in 
15191473    let  xs =  exprs |>  List. map (fun  e  -> Expression  e) in 
15201474    walk_list xs t rest
1521-   |  Pexp_jsx_unary_element  _  -> failwith " Pexp_jsx_unary_element 3" 
1522-   |  Pexp_jsx_container_element  _  -> failwith " Pexp_jsx_container_element 3" 
1475+   |  Pexp_jsx_unary_element  _  ->
1476+     (*  TODO: save me shulhi, not sure what needs to be done here *) 
1477+     () 
1478+   |  Pexp_jsx_container_element 
1479+       {
1480+         jsx_container_element_opening_tag_end =  opening_greater_than;
1481+         jsx_container_element_children =  children;
1482+       } ->
1483+     let  opening_token =  {expr.pexp_loc with  loc_end =  opening_greater_than} in 
1484+     let  on_same_line, rest =  partition_by_on_same_line opening_token comments in 
1485+     attach t.trailing opening_token on_same_line;
1486+     let  exprs = 
1487+       match  children with 
1488+       |  Parsetree. JSXChildrenSpreading  e  -> [e]
1489+       |  Parsetree. JSXChildrenItems  xs  -> xs
1490+     in 
1491+     let  xs =  exprs |>  List. map (fun  e  -> Expression  e) in 
1492+     walk_list xs t rest
15231493  |  Pexp_send  _  -> () 
15241494
15251495and  walk_expr_parameter  (_attrs , _argLbl , expr_opt , pattern ) t  comments  = 
0 commit comments