Skip to content

Commit bfebcdf

Browse files
committed
change Js_config.jsx_version variant
1 parent 438f896 commit bfebcdf

File tree

9 files changed

+65
-70
lines changed

9 files changed

+65
-70
lines changed

jscomp/common/js_config.ml

Lines changed: 5 additions & 6 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 5 additions & 6 deletions
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17338,7 +17338,7 @@ module Js_config : sig
1733817338
* along with this program; if not, write to the Free Software
1733917339
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
1734017340

17341-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
17341+
type jsx_version = Jsx_v3 | Jsx_v4
1734217342
type jsx_module = React
1734317343
type jsx_mode = Classic | Automatic
1734417344

@@ -17393,7 +17393,7 @@ val force_cmi : bool ref
1739317393

1739417394
val force_cmj : bool ref
1739517395

17396-
val jsx_version : jsx_version ref
17396+
val jsx_version : jsx_version option ref
1739717397

1739817398
val jsx_module: jsx_module ref
1739917399

@@ -17415,7 +17415,7 @@ val string_of_jsx_module : jsx_module -> string
1741517415

1741617416
val string_of_jsx_mode : jsx_mode -> string
1741717417

17418-
val jsx_version_of_int : int -> jsx_version
17418+
val jsx_version_of_int : int -> jsx_version option
1741917419

1742017420
val jsx_module_of_string : string -> jsx_module
1742117421

@@ -17457,7 +17457,7 @@ end = struct
1745717457

1745817458
(** Browser is not set via command line only for internal use *)
1745917459

17460-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
17460+
type jsx_version = Jsx_v3 | Jsx_v4
1746117461
type jsx_module = React
1746217462
type jsx_mode = Classic | Automatic
1746317463

@@ -17484,7 +17484,7 @@ let cmi_only = ref false
1748417484
let cmj_only = ref false
1748517485
let force_cmi = ref false
1748617486
let force_cmj = ref false
17487-
let jsx_version = ref NotSelected
17487+
let jsx_version = ref None
1748817488
let jsx_module = ref React
1748917489
let jsx_mode = ref Classic
1749017490
let js_stdout = ref true
@@ -17496,7 +17496,6 @@ let as_ppx = ref false
1749617496
let int_of_jsx_version = function
1749717497
| Jsx_v3 -> 3
1749817498
| Jsx_v4 -> 4
17499-
| NotSelected -> -1
1750017499

1750117500
let string_of_jsx_module = function
1750217501
| React -> "react"
@@ -17506,9 +17505,9 @@ let string_of_jsx_mode = function
1750617505
| Automatic -> "automatic"
1750717506

1750817507
let jsx_version_of_int = function
17509-
| 3 -> Jsx_v3
17510-
| 4 -> Jsx_v4
17511-
| _ -> NotSelected
17508+
| 3 -> Some Jsx_v3
17509+
| 4 -> Some Jsx_v4
17510+
| _ -> None
1751217511

1751317512
let jsx_module_of_string = function
1751417513
| "react" -> React
@@ -274251,10 +274250,10 @@ let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
274251274250
Ast_config.iter_on_bs_config_sigi ast;
274252274251
let ast =
274253274252
match !Js_config.jsx_version with
274254-
| NotSelected -> ast
274255-
| _ ->
274253+
| None -> ast
274254+
| Some jsxVersion ->
274256274255
let open Js_config in
274257-
let jsxVersion = int_of_jsx_version !jsx_version in
274256+
let jsxVersion = int_of_jsx_version jsxVersion in
274258274257
let jsxModule = string_of_jsx_module !jsx_module in
274259274258
let jsxMode = string_of_jsx_mode !jsx_mode in
274260274259
Reactjs_jsx_ppx.rewrite_signature ~jsxVersion ~jsxModule ~jsxMode ast
@@ -274271,10 +274270,10 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
274271274270
Ast_config.iter_on_bs_config_stru ast;
274272274271
let ast =
274273274272
match !Js_config.jsx_version with
274274-
| NotSelected -> ast
274275-
| _ ->
274273+
| None -> ast
274274+
| Some jsxVersion ->
274276274275
let open Js_config in
274277-
let jsxVersion = int_of_jsx_version !jsx_version in
274276+
let jsxVersion = int_of_jsx_version jsxVersion in
274278274277
let jsxModule = string_of_jsx_module !jsx_module in
274279274278
let jsxMode = string_of_jsx_mode !jsx_mode in
274280274279
Reactjs_jsx_ppx.rewrite_implementation ~jsxVersion ~jsxModule ~jsxMode
@@ -282609,7 +282608,7 @@ let implementation ~use_super_errors impl str : Js.Unsafe.obj =
282609282608
Lazy.force Super_main.setup);
282610282609

282611282610
try
282612-
Js_config.jsx_version := Js_config.Jsx_v3;
282611+
Js_config.jsx_version := Some Js_config.Jsx_v3;
282613282612
(* default *)
282614282613
let ast = impl (Lexing.from_string str) in
282615282614
let ast = Ppx_entry.rewrite_implementation ast in

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17338,7 +17338,7 @@ module Js_config : sig
1733817338
* along with this program; if not, write to the Free Software
1733917339
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
1734017340

17341-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
17341+
type jsx_version = Jsx_v3 | Jsx_v4
1734217342
type jsx_module = React
1734317343
type jsx_mode = Classic | Automatic
1734417344

@@ -17393,7 +17393,7 @@ val force_cmi : bool ref
1739317393

1739417394
val force_cmj : bool ref
1739517395

17396-
val jsx_version : jsx_version ref
17396+
val jsx_version : jsx_version option ref
1739717397

1739817398
val jsx_module: jsx_module ref
1739917399

@@ -17415,7 +17415,7 @@ val string_of_jsx_module : jsx_module -> string
1741517415

1741617416
val string_of_jsx_mode : jsx_mode -> string
1741717417

17418-
val jsx_version_of_int : int -> jsx_version
17418+
val jsx_version_of_int : int -> jsx_version option
1741917419

1742017420
val jsx_module_of_string : string -> jsx_module
1742117421

@@ -17457,7 +17457,7 @@ end = struct
1745717457

1745817458
(** Browser is not set via command line only for internal use *)
1745917459

17460-
type jsx_version = Jsx_v3 | Jsx_v4 | NotSelected
17460+
type jsx_version = Jsx_v3 | Jsx_v4
1746117461
type jsx_module = React
1746217462
type jsx_mode = Classic | Automatic
1746317463

@@ -17484,7 +17484,7 @@ let cmi_only = ref false
1748417484
let cmj_only = ref false
1748517485
let force_cmi = ref false
1748617486
let force_cmj = ref false
17487-
let jsx_version = ref NotSelected
17487+
let jsx_version = ref None
1748817488
let jsx_module = ref React
1748917489
let jsx_mode = ref Classic
1749017490
let js_stdout = ref true
@@ -17496,7 +17496,6 @@ let as_ppx = ref false
1749617496
let int_of_jsx_version = function
1749717497
| Jsx_v3 -> 3
1749817498
| Jsx_v4 -> 4
17499-
| NotSelected -> -1
1750017499

1750117500
let string_of_jsx_module = function
1750217501
| React -> "react"
@@ -17506,9 +17505,9 @@ let string_of_jsx_mode = function
1750617505
| Automatic -> "automatic"
1750717506

1750817507
let jsx_version_of_int = function
17509-
| 3 -> Jsx_v3
17510-
| 4 -> Jsx_v4
17511-
| _ -> NotSelected
17508+
| 3 -> Some Jsx_v3
17509+
| 4 -> Some Jsx_v4
17510+
| _ -> None
1751217511

1751317512
let jsx_module_of_string = function
1751417513
| "react" -> React
@@ -275714,10 +275713,10 @@ let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
275714275713
Ast_config.iter_on_bs_config_sigi ast;
275715275714
let ast =
275716275715
match !Js_config.jsx_version with
275717-
| NotSelected -> ast
275718-
| _ ->
275716+
| None -> ast
275717+
| Some jsxVersion ->
275719275718
let open Js_config in
275720-
let jsxVersion = int_of_jsx_version !jsx_version in
275719+
let jsxVersion = int_of_jsx_version jsxVersion in
275721275720
let jsxModule = string_of_jsx_module !jsx_module in
275722275721
let jsxMode = string_of_jsx_mode !jsx_mode in
275723275722
Reactjs_jsx_ppx.rewrite_signature ~jsxVersion ~jsxModule ~jsxMode ast
@@ -275734,10 +275733,10 @@ let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
275734275733
Ast_config.iter_on_bs_config_stru ast;
275735275734
let ast =
275736275735
match !Js_config.jsx_version with
275737-
| NotSelected -> ast
275738-
| _ ->
275736+
| None -> ast
275737+
| Some jsxVersion ->
275739275738
let open Js_config in
275740-
let jsxVersion = int_of_jsx_version !jsx_version in
275739+
let jsxVersion = int_of_jsx_version jsxVersion in
275741275740
let jsxModule = string_of_jsx_module !jsx_module in
275742275741
let jsxMode = string_of_jsx_mode !jsx_mode in
275743275742
Reactjs_jsx_ppx.rewrite_implementation ~jsxVersion ~jsxModule ~jsxMode
@@ -294368,7 +294367,7 @@ module Compile = struct
294368294367
let env = Res_compmisc.initial_env () in (* Question ?? *)
294369294368
(* let finalenv = ref Env.empty in *)
294370294369
let types_signature = ref [] in
294371-
Js_config.jsx_version := Js_config.Jsx_v3; (* default *)
294370+
Js_config.jsx_version := Some Js_config.Jsx_v3; (* default *)
294372294371
let ast = impl (str) in
294373294372
let ast = Ppx_entry.rewrite_implementation ast in
294374294373
let typed_tree =

0 commit comments

Comments
 (0)