Skip to content

Commit 9cbad12

Browse files
committed
remove jsx v2
1 parent 9acf25b commit 9cbad12

File tree

4 files changed

+99
-106
lines changed

4 files changed

+99
-106
lines changed

jscomp/main/js_main.ml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ let buckle_script_flags : (string * Arg.spec * string) list =
180180
)
181181
::
182182
("-bs-jsx",
183-
Arg.Int (fun i -> Js_config.jsx_version := i),
183+
Arg.Int (fun i ->
184+
(if i <> 3 then raise (Arg.Bad (" Not supported jsx version : " ^ string_of_int i)));
185+
Js_config.jsx_version := i),
184186
" Set jsx version"
185187
)
186188
::

jscomp/syntax/ppx_entry.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
2929
Ast_config.iter_on_bs_config_sigi ast;
3030
let ast =
3131
match !Js_config.jsx_version with
32-
| 2 -> Reactjs_jsx_ppx_v2.rewrite_signature ast
3332
| 3 -> Reactjs_jsx_ppx_v3.rewrite_signature ast
3433
| _ -> ast
3534
(* react-jsx ppx relies on built-in ones like `##` *)
@@ -48,8 +47,7 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
4847
Bs_ast_invariant.iter_warnings_on_stru ast ;
4948
Ast_config.iter_on_bs_config_stru ast ;
5049
let ast =
51-
match !Js_config.jsx_version with
52-
| 2 -> Reactjs_jsx_ppx_v2.rewrite_implementation ast
50+
match !Js_config.jsx_version with
5351
| 3 -> Reactjs_jsx_ppx_v3.rewrite_implementation ast
5452
| _ -> ast
5553
in

jscomp/syntax/reactjs_jsx_ppx.cppo.ml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -932,13 +932,8 @@ let jsxMapper () =
932932
(* Foo.createElement(~prop1=foo, ~prop2=bar, ~children=[], ()) *)
933933
| {loc; txt = Ldot (modulePath, ("createElement" | "make"))} ->
934934
(match !jsxVersion with
935-
#ifdef REACT_JS_JSX_V2
936-
| None
937-
| Some 2 -> transformUppercaseCall modulePath mapper loc attrs callExpression callArguments
938-
#else
939935
| Some 2 -> transformUppercaseCall modulePath mapper loc attrs callExpression callArguments
940936
| None
941-
#endif
942937
| Some 3 -> transformUppercaseCall3 modulePath mapper loc attrs callExpression callArguments
943938
| Some _ -> raise (Invalid_argument "JSX: the JSX version must be 2 or 3"))
944939

@@ -947,13 +942,8 @@ let jsxMapper () =
947942
ReactDOMRe.createElement(~props=ReactDOMRe.props(~props1=foo, ~props2=bar, ()), [|bla|]) *)
948943
| {loc; txt = Lident id} ->
949944
(match !jsxVersion with
950-
#ifdef REACT_JS_JSX_V2
951-
| None
952-
| Some 2 -> transformLowercaseCall mapper loc attrs callArguments id
953-
#else
954945
| Some 2 -> transformLowercaseCall mapper loc attrs callArguments id
955946
| None
956-
#endif
957947
| Some 3 -> transformLowercaseCall3 mapper loc attrs callArguments id
958948
| Some _ -> raise (Invalid_argument "JSX: the JSX version must be 2 or 3"))
959949

0 commit comments

Comments
 (0)