Skip to content

Commit d423c16

Browse files
committed
change Js_config.jsx_version variant
1 parent 1c10e4e commit d423c16

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
@@ -264478,10 +264477,10 @@ let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
264478264477
Ast_config.iter_on_bs_config_sigi ast;
264479264478
let ast =
264480264479
match !Js_config.jsx_version with
264481-
| NotSelected -> ast
264482-
| _ ->
264480+
| None -> ast
264481+
| Some jsxVersion ->
264483264482
let open Js_config in
264484-
let jsxVersion = int_of_jsx_version !jsx_version in
264483+
let jsxVersion = int_of_jsx_version jsxVersion in
264485264484
let jsxModule = string_of_jsx_module !jsx_module in
264486264485
let jsxMode = string_of_jsx_mode !jsx_mode in
264487264486
Reactjs_jsx_ppx.rewrite_signature ~jsxVersion ~jsxModule ~jsxMode ast
@@ -264498,10 +264497,10 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
264498264497
Ast_config.iter_on_bs_config_stru ast;
264499264498
let ast =
264500264499
match !Js_config.jsx_version with
264501-
| NotSelected -> ast
264502-
| _ ->
264500+
| None -> ast
264501+
| Some jsxVersion ->
264503264502
let open Js_config in
264504-
let jsxVersion = int_of_jsx_version !jsx_version in
264503+
let jsxVersion = int_of_jsx_version jsxVersion in
264505264504
let jsxModule = string_of_jsx_module !jsx_module in
264506264505
let jsxMode = string_of_jsx_mode !jsx_mode in
264507264506
Reactjs_jsx_ppx.rewrite_implementation ~jsxVersion ~jsxModule ~jsxMode
@@ -272838,7 +272837,7 @@ let implementation ~use_super_errors impl str : Js.Unsafe.obj =
272838272837
Lazy.force Super_main.setup);
272839272838

272840272839
try
272841-
Js_config.jsx_version := Js_config.Jsx_v3;
272840+
Js_config.jsx_version := Some Js_config.Jsx_v3;
272842272841
(* default *)
272843272842
let ast = impl (Lexing.from_string str) in
272844272843
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
@@ -265941,10 +265940,10 @@ let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
265941265940
Ast_config.iter_on_bs_config_sigi ast;
265942265941
let ast =
265943265942
match !Js_config.jsx_version with
265944-
| NotSelected -> ast
265945-
| _ ->
265943+
| None -> ast
265944+
| Some jsxVersion ->
265946265945
let open Js_config in
265947-
let jsxVersion = int_of_jsx_version !jsx_version in
265946+
let jsxVersion = int_of_jsx_version jsxVersion in
265948265947
let jsxModule = string_of_jsx_module !jsx_module in
265949265948
let jsxMode = string_of_jsx_mode !jsx_mode in
265950265949
Reactjs_jsx_ppx.rewrite_signature ~jsxVersion ~jsxModule ~jsxMode ast
@@ -265961,10 +265960,10 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
265961265960
Ast_config.iter_on_bs_config_stru ast;
265962265961
let ast =
265963265962
match !Js_config.jsx_version with
265964-
| NotSelected -> ast
265965-
| _ ->
265963+
| None -> ast
265964+
| Some jsxVersion ->
265966265965
let open Js_config in
265967-
let jsxVersion = int_of_jsx_version !jsx_version in
265966+
let jsxVersion = int_of_jsx_version jsxVersion in
265968265967
let jsxModule = string_of_jsx_module !jsx_module in
265969265968
let jsxMode = string_of_jsx_mode !jsx_mode in
265970265969
Reactjs_jsx_ppx.rewrite_implementation ~jsxVersion ~jsxModule ~jsxMode
@@ -294410,7 +294409,7 @@ module Compile = struct
294410294409
let env = Res_compmisc.initial_env () in (* Question ?? *)
294411294410
(* let finalenv = ref Env.empty in *)
294412294411
let types_signature = ref [] in
294413-
Js_config.jsx_version := Js_config.Jsx_v3; (* default *)
294412+
Js_config.jsx_version := Some Js_config.Jsx_v3; (* default *)
294414294413
let ast = impl (str) in
294415294414
let ast = Ppx_entry.rewrite_implementation ast in
294416294415
let typed_tree =

0 commit comments

Comments
 (0)