Skip to content

Commit d3c4f6e

Browse files
committed
Map child expressions
1 parent a65d7ed commit d3c4f6e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

compiler/syntax/src/jsx_v4.ml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,17 +1550,20 @@ let expr ~(config : Jsx_common.jsx_config) mapper expression =
15501550
let children_props =
15511551
match xs with
15521552
| [] -> empty_record ~loc:Location.none
1553-
| [child] -> record_of_children child
1553+
| [child] -> record_of_children (mapper.expr mapper child)
15541554
| _ -> (
15551555
match config.mode with
1556-
| "automatic" -> record_of_children @@ apply_jsx_array (Exp.array xs)
1556+
| "automatic" ->
1557+
record_of_children
1558+
@@ apply_jsx_array (Exp.array (List.map (mapper.expr mapper) xs))
15571559
| "classic" | _ -> empty_record ~loc:Location.none)
15581560
in
15591561
let args =
15601562
(nolabel, fragment) :: (nolabel, children_props)
15611563
::
15621564
(match config.mode with
1563-
| "classic" when List.length xs > 1 -> [(nolabel, Exp.array xs)]
1565+
| "classic" when List.length xs > 1 ->
1566+
[(nolabel, Exp.array (List.map (mapper.expr mapper) xs))]
15641567
| _ -> [])
15651568
in
15661569
Exp.apply ~loc ~attrs
@@ -1600,7 +1603,8 @@ let expr ~(config : Jsx_common.jsx_config) mapper expression =
16001603
({txt = Lident "::"; loc}, Some {pexp_desc = Pexp_tuple _})
16011604
| Pexp_construct ({txt = Lident "[]"; loc}, None) );
16021605
pexp_attributes;
1603-
} as list_items -> (
1606+
} as list_items
1607+
when false -> (
16041608
let jsx_attribute, non_jsx_attributes =
16051609
List.partition
16061610
(fun (attribute, _) -> attribute.txt = "JSX")

0 commit comments

Comments
 (0)