Skip to content

Commit fdec0e7

Browse files
authored
Merge pull request rescript-lang#5324 from rescript-lang/remove-unused-code
remove unused code
2 parents 9525c42 + 9fcd420 commit fdec0e7

File tree

7 files changed

+24
-150
lines changed

7 files changed

+24
-150
lines changed

jscomp/ml/cmi_format.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
(**************************************************************************)
1515

1616
type pers_flags =
17-
| Rectypes
1817
| Deprecated of string
19-
| Opaque
20-
| Unsafe_string
18+
19+
2120

2221
type error =
2322
Not_an_interface of string

jscomp/ml/cmi_format.mli

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
(**************************************************************************)
1515

1616
type pers_flags =
17-
| Rectypes
1817
| Deprecated of string
19-
| Opaque
20-
| Unsafe_string
18+
19+
2120

2221
type cmi_infos = {
2322
cmi_name : string;

jscomp/ml/env.ml

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ type error =
6161
| Illegal_renaming of string * string * string
6262
| Inconsistent_import of string * string * string
6363
| Need_recursive_types of string * string
64-
| Depend_on_unsafe_string_unit of string * string
6564
| Missing_module of Location.t * Path.t * Path.t
6665
| Illegal_value_name of Location.t * string
6766

@@ -659,15 +658,11 @@ let imported_units = ref StringSet.empty
659658
let add_import s =
660659
imported_units := StringSet.add s !imported_units
661660

662-
let imported_opaque_units = ref StringSet.empty
663-
664-
let add_imported_opaque s =
665-
imported_opaque_units := StringSet.add s !imported_opaque_units
666661

667662
let clear_imports () =
668663
Consistbl.clear crc_units;
669-
imported_units := StringSet.empty;
670-
imported_opaque_units := StringSet.empty
664+
imported_units := StringSet.empty
665+
671666

672667
let check_consistency ps =
673668
try
@@ -687,13 +682,6 @@ let check_consistency ps =
687682
let save_pers_struct crc ps =
688683
let modname = ps.ps_name in
689684
Hashtbl.add persistent_structures modname (Some ps);
690-
List.iter
691-
(function
692-
| Rectypes -> ()
693-
| Deprecated _ -> ()
694-
| Unsafe_string -> ()
695-
| Opaque -> add_imported_opaque modname)
696-
ps.ps_flags;
697685
Consistbl.set crc_units modname crc ps.ps_filename;
698686
add_import modname
699687

@@ -715,7 +703,7 @@ let acknowledge_pers_struct check modname
715703
let crcs = cmi.cmi_crcs in
716704
let flags = cmi.cmi_flags in
717705
let deprecated =
718-
List.fold_left (fun acc -> function Deprecated s -> Some s | _ -> acc) None
706+
List.fold_left (fun _ -> function Deprecated s -> Some s ) None
719707
flags
720708
in
721709
let comps =
@@ -733,16 +721,6 @@ let acknowledge_pers_struct check modname
733721
} in
734722
if ps.ps_name <> modname then
735723
error (Illegal_renaming(modname, ps.ps_name, filename));
736-
737-
List.iter
738-
(function
739-
| Rectypes ->
740-
error (Need_recursive_types(ps.ps_name, !current_unit))
741-
| Unsafe_string ->
742-
error (Depend_on_unsafe_string_unit (ps.ps_name, !current_unit));
743-
| Deprecated _ -> ()
744-
| Opaque -> add_imported_opaque modname)
745-
ps.ps_flags;
746724
if check then check_consistency ps;
747725
Hashtbl.add persistent_structures modname (Some ps);
748726
ps
@@ -797,9 +775,6 @@ let check_pers_struct name =
797775
Format.sprintf
798776
"%s uses recursive types"
799777
name
800-
| Depend_on_unsafe_string_unit (name, _) ->
801-
Printf.sprintf "%s uses -unsafe-string"
802-
name
803778
| Missing_module _ -> assert false
804779
| Illegal_value_name _ -> assert false
805780
in
@@ -2122,9 +2097,6 @@ let imports () =
21222097
(StringSet.fold
21232098
(fun m acc -> if m = x then acc else m::acc)
21242099
!imported_units []) crc_units
2125-
(* Returns true if [s] is an opaque imported module *)
2126-
let is_imported_opaque s =
2127-
StringSet.mem s !imported_opaque_units
21282100

21292101
(* Save a signature to a file *)
21302102

@@ -2317,11 +2289,6 @@ let report_error ppf = function
23172289
fprintf ppf
23182290
"@[<hov>Unit %s imports from %s, which uses recursive types.@ %s@]"
23192291
export import "The compilation flag -rectypes is required"
2320-
| Depend_on_unsafe_string_unit(import, export) ->
2321-
fprintf ppf
2322-
"@[<hov>Unit %s imports from %s, compiled with -unsafe-string.@ %s@]"
2323-
export import "This compiler has been configured in strict \
2324-
safe-string mode (-force-safe-string)"
23252292
| Missing_module(_, path1, path2) ->
23262293
fprintf ppf "@[@[<hov>";
23272294
if Path.same path1 path2 then

jscomp/ml/env.mli

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ val crc_of_unit: string -> Digest.t
210210

211211
val imports: unit -> (string * Digest.t option) list
212212

213-
(* [is_imported_opaque md] returns true if [md] is an opaque imported module *)
214-
val is_imported_opaque: string -> bool
213+
215214

216215
(* Direct access to the table of imported compilation units with their CRC *)
217216

@@ -236,7 +235,6 @@ type error =
236235
| Illegal_renaming of string * string * string
237236
| Inconsistent_import of string * string * string
238237
| Need_recursive_types of string * string
239-
| Depend_on_unsafe_string_unit of string * string
240238
| Missing_module of Location.t * Path.t * Path.t
241239
| Illegal_value_name of Location.t * string
242240

jscomp/super_errors/super_env.ml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ let report_error ppf = function
2323
fprintf ppf
2424
"@[<hov>Unit %s imports from %s, which uses recursive types.@ %s@]"
2525
export import "The compilation flag -rectypes is required"
26-
| Depend_on_unsafe_string_unit(import, export) ->
27-
fprintf ppf
28-
"@[<hov>Unit %s imports from %s, compiled with -unsafe-string.@ %s@]"
29-
export import "This compiler has been configured in strict \
30-
safe-string mode (-force-safe-string)"
3126
| Missing_module(_, path1, path2) ->
3227
fprintf ppf "@[@[<hov>";
3328
if Path.same path1 path2 then

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6158,10 +6158,9 @@ module Cmi_format : sig
61586158
(**************************************************************************)
61596159

61606160
type pers_flags =
6161-
| Rectypes
61626161
| Deprecated of string
6163-
| Opaque
6164-
| Unsafe_string
6162+
6163+
61656164

61666165
type cmi_infos = {
61676166
cmi_name : string;
@@ -6212,10 +6211,9 @@ end = struct
62126211
(**************************************************************************)
62136212

62146213
type pers_flags =
6215-
| Rectypes
62166214
| Deprecated of string
6217-
| Opaque
6218-
| Unsafe_string
6215+
6216+
62196217

62206218
type error =
62216219
Not_an_interface of string
@@ -14658,8 +14656,7 @@ val crc_of_unit: string -> Digest.t
1465814656

1465914657
val imports: unit -> (string * Digest.t option) list
1466014658

14661-
(* [is_imported_opaque md] returns true if [md] is an opaque imported module *)
14662-
val is_imported_opaque: string -> bool
14659+
1466314660

1466414661
(* Direct access to the table of imported compilation units with their CRC *)
1466514662

@@ -14684,7 +14681,6 @@ type error =
1468414681
| Illegal_renaming of string * string * string
1468514682
| Inconsistent_import of string * string * string
1468614683
| Need_recursive_types of string * string
14687-
| Depend_on_unsafe_string_unit of string * string
1468814684
| Missing_module of Location.t * Path.t * Path.t
1468914685
| Illegal_value_name of Location.t * string
1469014686

@@ -14837,7 +14833,6 @@ type error =
1483714833
| Illegal_renaming of string * string * string
1483814834
| Inconsistent_import of string * string * string
1483914835
| Need_recursive_types of string * string
14840-
| Depend_on_unsafe_string_unit of string * string
1484114836
| Missing_module of Location.t * Path.t * Path.t
1484214837
| Illegal_value_name of Location.t * string
1484314838

@@ -15435,15 +15430,11 @@ let imported_units = ref StringSet.empty
1543515430
let add_import s =
1543615431
imported_units := StringSet.add s !imported_units
1543715432

15438-
let imported_opaque_units = ref StringSet.empty
15439-
15440-
let add_imported_opaque s =
15441-
imported_opaque_units := StringSet.add s !imported_opaque_units
1544215433

1544315434
let clear_imports () =
1544415435
Consistbl.clear crc_units;
15445-
imported_units := StringSet.empty;
15446-
imported_opaque_units := StringSet.empty
15436+
imported_units := StringSet.empty
15437+
1544715438

1544815439
let check_consistency ps =
1544915440
try
@@ -15463,13 +15454,6 @@ let check_consistency ps =
1546315454
let save_pers_struct crc ps =
1546415455
let modname = ps.ps_name in
1546515456
Hashtbl.add persistent_structures modname (Some ps);
15466-
List.iter
15467-
(function
15468-
| Rectypes -> ()
15469-
| Deprecated _ -> ()
15470-
| Unsafe_string -> ()
15471-
| Opaque -> add_imported_opaque modname)
15472-
ps.ps_flags;
1547315457
Consistbl.set crc_units modname crc ps.ps_filename;
1547415458
add_import modname
1547515459

@@ -15491,7 +15475,7 @@ let acknowledge_pers_struct check modname
1549115475
let crcs = cmi.cmi_crcs in
1549215476
let flags = cmi.cmi_flags in
1549315477
let deprecated =
15494-
List.fold_left (fun acc -> function Deprecated s -> Some s | _ -> acc) None
15478+
List.fold_left (fun _ -> function Deprecated s -> Some s ) None
1549515479
flags
1549615480
in
1549715481
let comps =
@@ -15509,16 +15493,6 @@ let acknowledge_pers_struct check modname
1550915493
} in
1551015494
if ps.ps_name <> modname then
1551115495
error (Illegal_renaming(modname, ps.ps_name, filename));
15512-
15513-
List.iter
15514-
(function
15515-
| Rectypes ->
15516-
error (Need_recursive_types(ps.ps_name, !current_unit))
15517-
| Unsafe_string ->
15518-
error (Depend_on_unsafe_string_unit (ps.ps_name, !current_unit));
15519-
| Deprecated _ -> ()
15520-
| Opaque -> add_imported_opaque modname)
15521-
ps.ps_flags;
1552215496
if check then check_consistency ps;
1552315497
Hashtbl.add persistent_structures modname (Some ps);
1552415498
ps
@@ -15573,9 +15547,6 @@ let check_pers_struct name =
1557315547
Format.sprintf
1557415548
"%s uses recursive types"
1557515549
name
15576-
| Depend_on_unsafe_string_unit (name, _) ->
15577-
Printf.sprintf "%s uses -unsafe-string"
15578-
name
1557915550
| Missing_module _ -> assert false
1558015551
| Illegal_value_name _ -> assert false
1558115552
in
@@ -16898,9 +16869,6 @@ let imports () =
1689816869
(StringSet.fold
1689916870
(fun m acc -> if m = x then acc else m::acc)
1690016871
!imported_units []) crc_units
16901-
(* Returns true if [s] is an opaque imported module *)
16902-
let is_imported_opaque s =
16903-
StringSet.mem s !imported_opaque_units
1690416872

1690516873
(* Save a signature to a file *)
1690616874

@@ -17093,11 +17061,6 @@ let report_error ppf = function
1709317061
fprintf ppf
1709417062
"@[<hov>Unit %s imports from %s, which uses recursive types.@ %s@]"
1709517063
export import "The compilation flag -rectypes is required"
17096-
| Depend_on_unsafe_string_unit(import, export) ->
17097-
fprintf ppf
17098-
"@[<hov>Unit %s imports from %s, compiled with -unsafe-string.@ %s@]"
17099-
export import "This compiler has been configured in strict \
17100-
safe-string mode (-force-safe-string)"
1710117064
| Missing_module(_, path1, path2) ->
1710217065
fprintf ppf "@[@[<hov>";
1710317066
if Path.same path1 path2 then
@@ -267714,11 +267677,6 @@ let report_error ppf = function
267714267677
fprintf ppf
267715267678
"@[<hov>Unit %s imports from %s, which uses recursive types.@ %s@]"
267716267679
export import "The compilation flag -rectypes is required"
267717-
| Depend_on_unsafe_string_unit(import, export) ->
267718-
fprintf ppf
267719-
"@[<hov>Unit %s imports from %s, compiled with -unsafe-string.@ %s@]"
267720-
export import "This compiler has been configured in strict \
267721-
safe-string mode (-force-safe-string)"
267722267680
| Missing_module(_, path1, path2) ->
267723267681
fprintf ppf "@[@[<hov>";
267724267682
if Path.same path1 path2 then

0 commit comments

Comments
 (0)