Skip to content

Commit 9053f49

Browse files
committed
Clean up more unused class code.
1 parent 3d0eca6 commit 9053f49

File tree

6 files changed

+5
-37
lines changed

6 files changed

+5
-37
lines changed

jscomp/ml/env.ml

-11
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,6 @@ and find_type_full =
877877
find (fun env -> env.types) (fun sc -> sc.comp_types)
878878
and find_modtype =
879879
find (fun env -> env.modtypes) (fun sc -> sc.comp_modtypes)
880-
and find_class =
881-
find (fun env -> env.classes) (fun sc -> sc.comp_classes)
882880
and find_cltype =
883881
find (fun env -> env.cltypes) (fun sc -> sc.comp_cltypes)
884882

@@ -1238,8 +1236,6 @@ let lookup_type =
12381236
lookup (fun env -> env.types) (fun sc -> sc.comp_types)
12391237
let lookup_modtype =
12401238
lookup (fun env -> env.modtypes) (fun sc -> sc.comp_modtypes)
1241-
let lookup_class =
1242-
lookup (fun env -> env.classes) (fun sc -> sc.comp_classes)
12431239
let lookup_cltype =
12441240
lookup (fun env -> env.cltypes) (fun sc -> sc.comp_cltypes)
12451241

@@ -1370,13 +1366,6 @@ let lookup_all_labels ?loc lid env =
13701366
with
13711367
Not_found when is_lident lid -> []
13721368

1373-
let lookup_class ?loc lid env =
1374-
let (_, desc) as r = lookup_class ?loc lid env in
1375-
(* special support for Typeclass.unbound_class *)
1376-
if Path.name desc.cty_path = "" then ignore (lookup_type ?loc lid env)
1377-
else mark_type_path env desc.cty_path;
1378-
r
1379-
13801369
let lookup_cltype ?loc lid env =
13811370
let (_, desc) as r = lookup_cltype ?loc lid env in
13821371
if Path.name desc.clty_path = "" then ignore (lookup_type ?loc lid env)

jscomp/ml/env.mli

-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ val find_type: Path.t -> t -> type_declaration
6565
val find_type_descrs: Path.t -> t -> type_descriptions
6666
val find_module: Path.t -> t -> module_declaration
6767
val find_modtype: Path.t -> t -> modtype_declaration
68-
val find_class: Path.t -> t -> class_declaration
6968
val find_cltype: Path.t -> t -> class_type_declaration
7069

7170
val find_type_expansion:
@@ -119,8 +118,6 @@ val lookup_module:
119118
load:bool -> ?loc:Location.t -> Longident.t -> t -> Path.t
120119
val lookup_modtype:
121120
?loc:Location.t -> Longident.t -> t -> Path.t * modtype_declaration
122-
val lookup_class:
123-
?loc:Location.t -> Longident.t -> t -> Path.t * class_declaration
124121
val lookup_cltype:
125122
?loc:Location.t -> Longident.t -> t -> Path.t * class_type_declaration
126123

jscomp/ml/typecore.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ let type_open :
9898
let type_package =
9999
ref (fun _ -> assert false)
100100

101-
(* Forward declaration, to be filled in by Typeclass.class_structure *)
101+
(* Forward declaration, to be filled in by Typemod.type_package *)
102102

103103
(*
104104
Saving and outputting type information.
@@ -200,7 +200,7 @@ let iter_expression f e =
200200
| Pstr_exception _
201201
| Pstr_modtype _
202202
| Pstr_open _
203-
| Pstr_class_type _
203+
| Pstr_class_type ()
204204
| Pstr_attribute _
205205
| Pstr_extension _ -> ()
206206
| Pstr_include {pincl_mod = me}
@@ -1638,7 +1638,7 @@ and is_nonexpansive_mod mexp =
16381638
List.for_all
16391639
(fun item -> match item.str_desc with
16401640
| Tstr_eval _ | Tstr_primitive _ | Tstr_type _
1641-
| Tstr_modtype _ | Tstr_open _ | Tstr_class_type _ -> true
1641+
| Tstr_modtype _ | Tstr_open _ | Tstr_class_type () -> true
16421642
| Tstr_value (_, pat_exp_list) ->
16431643
List.for_all (fun vb -> is_nonexpansive vb.vb_expr) pat_exp_list
16441644
| Tstr_module {mb_expr=m;_}
@@ -1654,7 +1654,7 @@ and is_nonexpansive_mod mexp =
16541654
(function {ext_kind = Text_decl _} -> false
16551655
| {ext_kind = Text_rebind _} -> true)
16561656
te.tyext_constructors
1657-
| Tstr_class _ -> false (* could be more precise *)
1657+
| Tstr_class () -> assert false (* impossible *)
16581658
| Tstr_attribute _ -> true
16591659
)
16601660
str.str_items

jscomp/ml/typecore.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ val type_open:
128128
(?used_slot:bool ref -> override_flag -> Env.t -> Location.t ->
129129
Longident.t loc -> Path.t * Env.t)
130130
ref
131-
(* Forward declaration, to be filled in by Typeclass.class_structure *)
131+
(* Forward declaration, to be filled in by Typemod.type_package *)
132132
val type_package:
133133
(Env.t -> Parsetree.module_expr -> Path.t -> Longident.t list ->
134134
Typedtree.module_expr * type_expr list) ref

jscomp/ml/typetexp.ml

-14
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,6 @@ let find_label =
144144
let find_all_labels =
145145
find_component Env.lookup_all_labels (fun lid -> Unbound_label lid)
146146

147-
let find_class env loc lid =
148-
let (path, decl) as r =
149-
find_component Env.lookup_class (fun lid -> Unbound_class lid) env loc lid
150-
in
151-
Builtin_attributes.check_deprecated loc decl.cty_attributes (Path.name path);
152-
r
153147

154148
let find_value env loc lid =
155149
Env.check_value_name (Longident.last lid) loc;
@@ -177,14 +171,6 @@ let find_modtype env loc lid =
177171
Builtin_attributes.check_deprecated loc decl.mtd_attributes (Path.name path);
178172
r
179173

180-
let find_class_type env loc lid =
181-
let (path, decl) as r =
182-
find_component Env.lookup_cltype (fun lid -> Unbound_cltype lid)
183-
env loc lid
184-
in
185-
Builtin_attributes.check_deprecated loc decl.clty_attributes (Path.name path);
186-
r
187-
188174
let unbound_constructor_error env lid =
189175
narrow_unbound_lid_error env lid.loc lid.txt
190176
(fun lid -> Unbound_constructor lid)

jscomp/ml/typetexp.mli

-4
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,12 @@ val find_all_labels:
100100
(label_description * (unit -> unit)) list
101101
val find_value:
102102
Env.t -> Location.t -> Longident.t -> Path.t * value_description
103-
val find_class:
104-
Env.t -> Location.t -> Longident.t -> Path.t * class_declaration
105103
val find_module:
106104
Env.t -> Location.t -> Longident.t -> Path.t * module_declaration
107105
val lookup_module:
108106
?load:bool -> Env.t -> Location.t -> Longident.t -> Path.t
109107
val find_modtype:
110108
Env.t -> Location.t -> Longident.t -> Path.t * modtype_declaration
111-
val find_class_type:
112-
Env.t -> Location.t -> Longident.t -> Path.t * class_type_declaration
113109

114110
val unbound_constructor_error: Env.t -> Longident.t Location.loc -> 'a
115111
val unbound_label_error: Env.t -> Longident.t Location.loc -> 'a

0 commit comments

Comments
 (0)