Skip to content

Commit 4b8a0c5

Browse files
Copilottsnobip
andcommitted
Drop support of JSX children spread
Co-authored-by: tsnobip <[email protected]>
1 parent 0fdd480 commit 4b8a0c5

26 files changed

+13
-393
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#### :boom: Breaking Change
1616

1717
- Fix return type of `String.charCodeAt`. https://github.com/rescript-lang/rescript/pull/7864
18+
- Remove support of JSX children spread. https://github.com/rescript-lang/rescript/pull/7869
1819

1920
#### :eyeglasses: Spec Compliance
2021

analysis/src/CompletionFrontEnd.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,8 +1412,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
14121412
(Jsx_container_element
14131413
{
14141414
jsx_container_element_closing_tag = None;
1415-
jsx_container_element_children =
1416-
JSXChildrenSpreading _ | JSXChildrenItems (_ :: _);
1415+
jsx_container_element_children = JSXChildrenItems (_ :: _);
14171416
}) ) ->
14181417
None
14191418
| Some jsxProps, _ ->

analysis/src/CompletionJsx.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ let extractJsxProps ~(compName : Longident.t Location.loc) ~props ~children =
461461
let childrenStart =
462462
match children with
463463
| JSXChildrenItems [] -> None
464-
| JSXChildrenSpreading child | JSXChildrenItems (child :: _) ->
464+
| JSXChildrenItems (child :: _) ->
465465
if child.pexp_loc.loc_ghost then None else Some (Loc.start child.pexp_loc)
466466
in
467467
let props =

analysis/src/SemanticTokens.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ let command ~debug ~emitter ~path =
312312

313313
(* children *)
314314
(match children with
315-
| Parsetree.JSXChildrenSpreading child -> iterator.expr iterator child
316315
| Parsetree.JSXChildrenItems children ->
317316
List.iter (iterator.expr iterator) children);
318317

compiler/frontend/bs_ast_mapper.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ end
293293

294294
module E = struct
295295
let map_jsx_children sub = function
296-
| JSXChildrenSpreading e -> JSXChildrenSpreading (sub.expr sub e)
297296
| JSXChildrenItems xs -> JSXChildrenItems (List.map (sub.expr sub) xs)
298297

299298
let map_jsx_prop sub = function

compiler/ml/ast_iterator.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ end
268268

269269
module E = struct
270270
let iter_jsx_children sub = function
271-
| JSXChildrenSpreading e -> sub.expr sub e
272271
| JSXChildrenItems xs -> List.iter (sub.expr sub) xs
273272

274273
let iter_jsx_prop sub = function

compiler/ml/ast_mapper.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ end
264264

265265
module E = struct
266266
let map_jsx_children sub = function
267-
| JSXChildrenSpreading e -> JSXChildrenSpreading (sub.expr sub e)
268267
| JSXChildrenItems xs -> JSXChildrenItems (List.map (sub.expr sub) xs)
269268

270269
let map_jsx_prop sub = function

compiler/ml/ast_mapper_from0.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ module E = struct
327327
| Pexp_construct ({txt = Longident.Lident "[]" | Longident.Lident "::"}, _)
328328
->
329329
JSXChildrenItems (visit e)
330-
| _ -> JSXChildrenSpreading (sub.expr sub e)
330+
| _ -> JSXChildrenItems [sub.expr sub e]
331331

332332
let try_map_jsx_prop (sub : mapper) (lbl : Asttypes.Noloc.arg_label)
333333
(e : expression) : Parsetree.jsx_prop option =

compiler/ml/ast_mapper_to0.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ module E = struct
340340

341341
let map_jsx_children sub loc children =
342342
match children with
343-
| JSXChildrenSpreading e -> sub.expr sub e
344343
| JSXChildrenItems xs ->
345344
let list_expr = Ast_helper.Exp.make_list_expression loc xs None in
346345
sub.expr sub list_expr

compiler/ml/depend.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ let rec add_expr bv exp =
313313
add_jsx_children bv children
314314

315315
and add_jsx_children bv = function
316-
| JSXChildrenSpreading e -> add_expr bv e
317316
| JSXChildrenItems xs -> List.iter (add_expr bv) xs
318317

319318
and add_jsx_prop bv = function

0 commit comments

Comments
 (0)