Skip to content

Commit 120641e

Browse files
committed
change Js_config.jsx_version variant
1 parent 5cc389d commit 120641e

File tree

9 files changed

+65
-70
lines changed

9 files changed

+65
-70
lines changed

jscomp/common/js_config.ml

+5-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
(** Browser is not set via command line only for internal use *)
2727

28-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
28+
type jsx_version = Jsx_v3 | Jsx_v4
2929
type jsx_module = React
3030
type jsx_mode = Classic | Automatic
3131

@@ -55,7 +55,7 @@ let cmi_only = ref false
5555
let cmj_only = ref false
5656
let force_cmi = ref false
5757
let force_cmj = ref false
58-
let jsx_version = ref NotSelected
58+
let jsx_version = ref None
5959
let jsx_module = ref React
6060
let jsx_mode = ref Classic
6161
let js_stdout = ref true
@@ -67,7 +67,6 @@ let as_ppx = ref false
6767
let int_of_jsx_version = function
6868
| Jsx_v3 -> 3
6969
| Jsx_v4 -> 4
70-
| NotSelected -> -1
7170

7271
let string_of_jsx_module = function
7372
| React -> "react"
@@ -77,9 +76,9 @@ let string_of_jsx_mode = function
7776
| Automatic -> "automatic"
7877

7978
let jsx_version_of_int = function
80-
| 3 -> Jsx_v3
81-
| 4 -> Jsx_v4
82-
| _ -> NotSelected
79+
| 3 -> Some Jsx_v3
80+
| 4 -> Some Jsx_v4
81+
| _ -> None
8382

8483
let jsx_module_of_string = function
8584
| "react" -> React

jscomp/common/js_config.mli

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
25+
type jsx_version = Jsx_v3 | Jsx_v4
2626
type jsx_module = React
2727
type jsx_mode = Classic | Automatic
2828

@@ -77,7 +77,7 @@ val force_cmi : bool ref
7777

7878
val force_cmj : bool ref
7979

80-
val jsx_version : jsx_version ref
80+
val jsx_version : jsx_version option ref
8181

8282
val jsx_module: jsx_module ref
8383

@@ -99,7 +99,7 @@ val string_of_jsx_module : jsx_module -> string
9999

100100
val string_of_jsx_mode : jsx_mode -> string
101101

102-
val jsx_version_of_int : int -> jsx_version
102+
val jsx_version_of_int : int -> jsx_version option
103103

104104
val jsx_module_of_string : string -> jsx_module
105105

jscomp/common/js_config.pp.ml

+5-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
(** Browser is not set via command line only for internal use *)
2626

27-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
27+
type jsx_version = Jsx_v3 | Jsx_v4
2828
type jsx_module = React
2929
type jsx_mode = Classic | Automatic
3030

@@ -53,7 +53,7 @@ let cmi_only = ref false
5353
let cmj_only = ref false
5454
let force_cmi = ref false
5555
let force_cmj = ref false
56-
let jsx_version = ref NotSelected
56+
let jsx_version = ref None
5757
let jsx_module = ref React
5858
let jsx_mode = ref Classic
5959
let js_stdout = ref true
@@ -65,7 +65,6 @@ let as_ppx = ref false
6565
let int_of_jsx_version = function
6666
| Jsx_v3 -> 3
6767
| Jsx_v4 -> 4
68-
| NotSelected -> -1
6968

7069
let string_of_jsx_module = function
7170
| React -> "react"
@@ -75,9 +74,9 @@ let string_of_jsx_mode = function
7574
| Automatic -> "automatic"
7675

7776
let jsx_version_of_int = function
78-
| 3 -> Jsx_v3
79-
| 4 -> Jsx_v4
80-
| _ -> NotSelected
77+
| 3 -> Some Jsx_v3
78+
| 4 -> Some Jsx_v4
79+
| _ -> None
8180

8281
let jsx_module_of_string = function
8382
| "react" -> React

jscomp/frontend/ppx_entry.ml

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ 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-
| NotSelected -> ast
33-
| _ ->
32+
| None -> ast
33+
| Some jsxVersion ->
3434
let open Js_config in
35-
let jsxVersion = int_of_jsx_version !jsx_version in
35+
let jsxVersion = int_of_jsx_version jsxVersion in
3636
let jsxModule = string_of_jsx_module !jsx_module in
3737
let jsxMode = string_of_jsx_mode !jsx_mode in
3838
Reactjs_jsx_ppx.rewrite_signature ~jsxVersion ~jsxModule ~jsxMode ast
@@ -49,10 +49,10 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
4949
Ast_config.iter_on_bs_config_stru ast;
5050
let ast =
5151
match !Js_config.jsx_version with
52-
| NotSelected -> ast
53-
| _ ->
52+
| None -> ast
53+
| Some jsxVersion ->
5454
let open Js_config in
55-
let jsxVersion = int_of_jsx_version !jsx_version in
55+
let jsxVersion = int_of_jsx_version jsxVersion in
5656
let jsxModule = string_of_jsx_module !jsx_module in
5757
let jsxMode = string_of_jsx_mode !jsx_mode in
5858
Reactjs_jsx_ppx.rewrite_implementation ~jsxVersion ~jsxModule ~jsxMode

jscomp/main/jsoo_main.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ let implementation ~use_super_errors impl str : Js.Unsafe.obj =
5959
Lazy.force Super_main.setup);
6060

6161
try
62-
Js_config.jsx_version := Js_config.Jsx_v3;
62+
Js_config.jsx_version := Some Js_config.Jsx_v3;
6363
(* default *)
6464
let ast = impl (Lexing.from_string str) in
6565
let ast = Ppx_entry.rewrite_implementation ast in

jscomp/main/jsoo_playground_main.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ module Compile = struct
474474
let env = Res_compmisc.initial_env () in (* Question ?? *)
475475
(* let finalenv = ref Env.empty in *)
476476
let types_signature = ref [] in
477-
Js_config.jsx_version := Js_config.Jsx_v3; (* default *)
477+
Js_config.jsx_version := Some Js_config.Jsx_v3; (* default *)
478478
let ast = impl (str) in
479479
let ast = Ppx_entry.rewrite_implementation ast in
480480
let typed_tree =

lib/4.06.1/unstable/js_compiler.ml

+15-16
Original file line numberDiff line numberDiff line change
@@ -17334,7 +17334,7 @@ module Js_config : sig
1733417334
* along with this program; if not, write to the Free Software
1733517335
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
1733617336

17337-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
17337+
type jsx_version = Jsx_v3 | Jsx_v4
1733817338
type jsx_module = React
1733917339
type jsx_mode = Classic | Automatic
1734017340

@@ -17389,7 +17389,7 @@ val force_cmi : bool ref
1738917389

1739017390
val force_cmj : bool ref
1739117391

17392-
val jsx_version : jsx_version ref
17392+
val jsx_version : jsx_version option ref
1739317393

1739417394
val jsx_module: jsx_module ref
1739517395

@@ -17411,7 +17411,7 @@ val string_of_jsx_module : jsx_module -> string
1741117411

1741217412
val string_of_jsx_mode : jsx_mode -> string
1741317413

17414-
val jsx_version_of_int : int -> jsx_version
17414+
val jsx_version_of_int : int -> jsx_version option
1741517415

1741617416
val jsx_module_of_string : string -> jsx_module
1741717417

@@ -17453,7 +17453,7 @@ end = struct
1745317453

1745417454
(** Browser is not set via command line only for internal use *)
1745517455

17456-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
17456+
type jsx_version = Jsx_v3 | Jsx_v4
1745717457
type jsx_module = React
1745817458
type jsx_mode = Classic | Automatic
1745917459

@@ -17480,7 +17480,7 @@ let cmi_only = ref false
1748017480
let cmj_only = ref false
1748117481
let force_cmi = ref false
1748217482
let force_cmj = ref false
17483-
let jsx_version = ref NotSelected
17483+
let jsx_version = ref None
1748417484
let jsx_module = ref React
1748517485
let jsx_mode = ref Classic
1748617486
let js_stdout = ref true
@@ -17492,7 +17492,6 @@ let as_ppx = ref false
1749217492
let int_of_jsx_version = function
1749317493
| Jsx_v3 -> 3
1749417494
| Jsx_v4 -> 4
17495-
| NotSelected -> -1
1749617495

1749717496
let string_of_jsx_module = function
1749817497
| React -> "react"
@@ -17502,9 +17501,9 @@ let string_of_jsx_mode = function
1750217501
| Automatic -> "automatic"
1750317502

1750417503
let jsx_version_of_int = function
17505-
| 3 -> Jsx_v3
17506-
| 4 -> Jsx_v4
17507-
| _ -> NotSelected
17504+
| 3 -> Some Jsx_v3
17505+
| 4 -> Some Jsx_v4
17506+
| _ -> None
1750817507

1750917508
let jsx_module_of_string = function
1751017509
| "react" -> React
@@ -274094,10 +274093,10 @@ let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
274094274093
Ast_config.iter_on_bs_config_sigi ast;
274095274094
let ast =
274096274095
match !Js_config.jsx_version with
274097-
| NotSelected -> ast
274098-
| _ ->
274096+
| None -> ast
274097+
| Some jsxVersion ->
274099274098
let open Js_config in
274100-
let jsxVersion = int_of_jsx_version !jsx_version in
274099+
let jsxVersion = int_of_jsx_version jsxVersion in
274101274100
let jsxModule = string_of_jsx_module !jsx_module in
274102274101
let jsxMode = string_of_jsx_mode !jsx_mode in
274103274102
Reactjs_jsx_ppx.rewrite_signature ~jsxVersion ~jsxModule ~jsxMode ast
@@ -274114,10 +274113,10 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
274114274113
Ast_config.iter_on_bs_config_stru ast;
274115274114
let ast =
274116274115
match !Js_config.jsx_version with
274117-
| NotSelected -> ast
274118-
| _ ->
274116+
| None -> ast
274117+
| Some jsxVersion ->
274119274118
let open Js_config in
274120-
let jsxVersion = int_of_jsx_version !jsx_version in
274119+
let jsxVersion = int_of_jsx_version jsxVersion in
274121274120
let jsxModule = string_of_jsx_module !jsx_module in
274122274121
let jsxMode = string_of_jsx_mode !jsx_mode in
274123274122
Reactjs_jsx_ppx.rewrite_implementation ~jsxVersion ~jsxModule ~jsxMode
@@ -282449,7 +282448,7 @@ let implementation ~use_super_errors impl str : Js.Unsafe.obj =
282449282448
Lazy.force Super_main.setup);
282450282449

282451282450
try
282452-
Js_config.jsx_version := Js_config.Jsx_v3;
282451+
Js_config.jsx_version := Some Js_config.Jsx_v3;
282453282452
(* default *)
282454282453
let ast = impl (Lexing.from_string str) in
282455282454
let ast = Ppx_entry.rewrite_implementation ast in

lib/4.06.1/unstable/js_playground_compiler.ml

+15-16
Original file line numberDiff line numberDiff line change
@@ -17334,7 +17334,7 @@ module Js_config : sig
1733417334
* along with this program; if not, write to the Free Software
1733517335
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
1733617336

17337-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
17337+
type jsx_version = Jsx_v3 | Jsx_v4
1733817338
type jsx_module = React
1733917339
type jsx_mode = Classic | Automatic
1734017340

@@ -17389,7 +17389,7 @@ val force_cmi : bool ref
1738917389

1739017390
val force_cmj : bool ref
1739117391

17392-
val jsx_version : jsx_version ref
17392+
val jsx_version : jsx_version option ref
1739317393

1739417394
val jsx_module: jsx_module ref
1739517395

@@ -17411,7 +17411,7 @@ val string_of_jsx_module : jsx_module -> string
1741117411

1741217412
val string_of_jsx_mode : jsx_mode -> string
1741317413

17414-
val jsx_version_of_int : int -> jsx_version
17414+
val jsx_version_of_int : int -> jsx_version option
1741517415

1741617416
val jsx_module_of_string : string -> jsx_module
1741717417

@@ -17453,7 +17453,7 @@ end = struct
1745317453

1745417454
(** Browser is not set via command line only for internal use *)
1745517455

17456-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
17456+
type jsx_version = Jsx_v3 | Jsx_v4
1745717457
type jsx_module = React
1745817458
type jsx_mode = Classic | Automatic
1745917459

@@ -17480,7 +17480,7 @@ let cmi_only = ref false
1748017480
let cmj_only = ref false
1748117481
let force_cmi = ref false
1748217482
let force_cmj = ref false
17483-
let jsx_version = ref NotSelected
17483+
let jsx_version = ref None
1748417484
let jsx_module = ref React
1748517485
let jsx_mode = ref Classic
1748617486
let js_stdout = ref true
@@ -17492,7 +17492,6 @@ let as_ppx = ref false
1749217492
let int_of_jsx_version = function
1749317493
| Jsx_v3 -> 3
1749417494
| Jsx_v4 -> 4
17495-
| NotSelected -> -1
1749617495

1749717496
let string_of_jsx_module = function
1749817497
| React -> "react"
@@ -17502,9 +17501,9 @@ let string_of_jsx_mode = function
1750217501
| Automatic -> "automatic"
1750317502

1750417503
let jsx_version_of_int = function
17505-
| 3 -> Jsx_v3
17506-
| 4 -> Jsx_v4
17507-
| _ -> NotSelected
17504+
| 3 -> Some Jsx_v3
17505+
| 4 -> Some Jsx_v4
17506+
| _ -> None
1750817507

1750917508
let jsx_module_of_string = function
1751017509
| "react" -> React
@@ -275557,10 +275556,10 @@ let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
275557275556
Ast_config.iter_on_bs_config_sigi ast;
275558275557
let ast =
275559275558
match !Js_config.jsx_version with
275560-
| NotSelected -> ast
275561-
| _ ->
275559+
| None -> ast
275560+
| Some jsxVersion ->
275562275561
let open Js_config in
275563-
let jsxVersion = int_of_jsx_version !jsx_version in
275562+
let jsxVersion = int_of_jsx_version jsxVersion in
275564275563
let jsxModule = string_of_jsx_module !jsx_module in
275565275564
let jsxMode = string_of_jsx_mode !jsx_mode in
275566275565
Reactjs_jsx_ppx.rewrite_signature ~jsxVersion ~jsxModule ~jsxMode ast
@@ -275577,10 +275576,10 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
275577275576
Ast_config.iter_on_bs_config_stru ast;
275578275577
let ast =
275579275578
match !Js_config.jsx_version with
275580-
| NotSelected -> ast
275581-
| _ ->
275579+
| None -> ast
275580+
| Some jsxVersion ->
275582275581
let open Js_config in
275583-
let jsxVersion = int_of_jsx_version !jsx_version in
275582+
let jsxVersion = int_of_jsx_version jsxVersion in
275584275583
let jsxModule = string_of_jsx_module !jsx_module in
275585275584
let jsxMode = string_of_jsx_mode !jsx_mode in
275586275585
Reactjs_jsx_ppx.rewrite_implementation ~jsxVersion ~jsxModule ~jsxMode
@@ -294208,7 +294207,7 @@ module Compile = struct
294208294207
let env = Res_compmisc.initial_env () in (* Question ?? *)
294209294208
(* let finalenv = ref Env.empty in *)
294210294209
let types_signature = ref [] in
294211-
Js_config.jsx_version := Js_config.Jsx_v3; (* default *)
294210+
Js_config.jsx_version := Some Js_config.Jsx_v3; (* default *)
294212294211
let ast = impl (str) in
294213294212
let ast = Ppx_entry.rewrite_implementation ast in
294214294213
let typed_tree =

0 commit comments

Comments
 (0)