Skip to content

Commit 0a60758

Browse files
committed
Clean up Sig_class_type and dead code.
1 parent 9053f49 commit 0a60758

File tree

8 files changed

+23
-49
lines changed

8 files changed

+23
-49
lines changed

jscomp/ml/btype.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ let type_iterators =
330330
| Sig_module (_, md, _) -> it.it_module_declaration it md
331331
| Sig_modtype (_, mtd) -> it.it_modtype_declaration it mtd
332332
| Sig_class () -> assert false
333-
| Sig_class_type (_, ctd, _) -> it.it_class_type_declaration it ctd
333+
| Sig_class_type () -> assert false
334334
and it_value_description it vd =
335335
it.it_type_expr it vd.val_type
336336
and it_type_declaration it td =

jscomp/ml/env.ml

+6-12
Original file line numberDiff line numberDiff line change
@@ -1577,12 +1577,9 @@ let rec prefix_idents root pos sub = function
15771577
(Subst.add_modtype id (Mty_ident p) sub) rem in
15781578
(p::pl, final_sub)
15791579
| Sig_class _ :: _ ->
1580-
assert false
1581-
| Sig_class_type(id, _, _) :: rem ->
1582-
let p = Pdot(root, Ident.name id, nopos) in
1583-
let (pl, final_sub) =
1584-
prefix_idents root pos (Subst.add_type id p sub) rem in
1585-
(p::pl, final_sub)
1580+
assert false
1581+
| Sig_class_type _ :: _ ->
1582+
assert false
15861583

15871584
let prefix_idents root sub sg =
15881585
if sub = Subst.identity then
@@ -1688,10 +1685,7 @@ and components_of_module_maker (env, sub, path, mty) =
16881685
Tbl.add (Ident.name id) (decl', nopos) c.comp_modtypes;
16891686
env := store_modtype id decl !env
16901687
| Sig_class () -> assert false
1691-
| Sig_class_type(id, decl, _) ->
1692-
let decl' = Subst.cltype_declaration sub decl in
1693-
c.comp_cltypes <-
1694-
Tbl.add (Ident.name id) (decl', !pos) c.comp_cltypes)
1688+
| Sig_class_type () -> assert false)
16951689
sg pl;
16961690
Some (Structure_comps c)
16971691
| Mty_functor(param, ty_arg, ty_res) ->
@@ -1946,8 +1940,8 @@ let add_item comp env =
19461940
| Sig_typext(id, ext, _) -> add_extension ~check:false id ext env
19471941
| Sig_module(id, md, _) -> add_module_declaration ~check:false id md env
19481942
| Sig_modtype(id, decl) -> add_modtype id decl env
1949-
| Sig_class() -> env
1950-
| Sig_class_type(id, decl, _) -> add_cltype id decl env
1943+
| Sig_class () -> env
1944+
| Sig_class_type () -> env
19511945

19521946
let rec add_signature sg env =
19531947
match sg with

jscomp/ml/includemod.ml

+8-22
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,6 @@ let extension_constructors ~loc env cxt subst id ext1 ext2 =
7878
then ()
7979
else raise(Error[cxt, env, Extension_constructors(id, ext1, ext2)])
8080

81-
(* Inclusion between class declarations *)
82-
83-
let class_type_declarations ~loc ~old_env env cxt subst id decl1 decl2 =
84-
let decl2 = Subst.cltype_declaration subst decl2 in
85-
match Includeclass.class_type_declarations ~loc env decl1 decl2 with
86-
[] -> ()
87-
| reason ->
88-
raise(Error[cxt, old_env,
89-
Class_type_declarations(id, decl1, decl2, reason)])
90-
9181

9282
(* Expand a module type identifier when possible *)
9383

@@ -123,15 +113,13 @@ type field_desc =
123113
| Field_typext of string
124114
| Field_module of string
125115
| Field_modtype of string
126-
| Field_classtype of string
127116

128117
let kind_of_field_desc = function
129118
| Field_value _ -> "value"
130119
| Field_type _ -> "type"
131120
| Field_typext _ -> "extension constructor"
132121
| Field_module _ -> "module"
133122
| Field_modtype _ -> "module type"
134-
| Field_classtype _ -> "class type"
135123

136124
let item_ident_name = function
137125
Sig_value(id, d) -> (id, d.val_loc, Field_value(Ident.name id))
@@ -140,13 +128,13 @@ let item_ident_name = function
140128
| Sig_module(id, d, _) -> (id, d.md_loc, Field_module(Ident.name id))
141129
| Sig_modtype(id, d) -> (id, d.mtd_loc, Field_modtype(Ident.name id))
142130
| Sig_class () -> assert false
143-
| Sig_class_type(id, d, _) -> (id, d.clty_loc, Field_classtype(Ident.name id))
131+
| Sig_class_type () -> assert false
144132

145133
let is_runtime_component = function
146134
| Sig_value(_,{val_kind = Val_prim _})
147135
| Sig_type(_,_,_)
148136
| Sig_modtype(_,_)
149-
| Sig_class_type(_,_,_) -> false
137+
| Sig_class_type() -> false
150138
| Sig_value(_,_)
151139
| Sig_typext(_,_,_)
152140
| Sig_module(_,_,_)
@@ -315,9 +303,9 @@ and signatures ~loc env cxt subst sig1 sig2 =
315303
| Sig_module (i,_,_)
316304
| Sig_typext (i,_,_)
317305
| Sig_modtype(i,_)
318-
| Sig_class_type(i,_,_)
319306
| Sig_type(i,_,_) -> Ident.name i
320-
| Sig_class () -> assert false in
307+
| Sig_class ()
308+
| Sig_class_type () -> assert false in
321309
List.fold_right (fun item fields ->
322310
if is_runtime_component item then get_id item :: fields else fields) sig2 [] in
323311

@@ -379,7 +367,7 @@ and signatures ~loc env cxt subst sig1 sig2 =
379367
| Sig_modtype _ ->
380368
Subst.add_modtype id2 (Mty_ident (Pident id1)) subst
381369
| Sig_value _ | Sig_typext _
382-
| Sig_class _ | Sig_class_type _ ->
370+
| Sig_class _ | Sig_class_type () ->
383371
subst
384372
in
385373
pair_components new_subst
@@ -420,11 +408,9 @@ and signature_components ~loc old_env env cxt subst paired =
420408
| (Sig_modtype(id1, info1), Sig_modtype(_id2, info2), _pos) :: rem ->
421409
modtype_infos ~loc env cxt subst id1 info1 info2;
422410
comps_rec rem
423-
| (Sig_class _, Sig_class _ , _) :: _ -> assert false
424-
| (Sig_class_type(id1, info1, _),
425-
Sig_class_type(_id2, info2, _), _pos) :: rem ->
426-
class_type_declarations ~loc ~old_env env cxt subst id1 info1 info2;
427-
comps_rec rem
411+
| (Sig_class (), Sig_class () , _) :: _ -> assert false
412+
| (Sig_class_type(),
413+
Sig_class_type(), _pos) :: _ -> assert false
428414
| _ ->
429415
assert false
430416

jscomp/ml/mtype.ml

+2-4
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,8 @@ let nondep_supertype env mid mty =
162162
mtd_attributes=[]}) :: rem'
163163
| _ -> raise Not_found
164164
end
165-
| Sig_class _ -> assert false
166-
| Sig_class_type(id, d, rs) ->
167-
Sig_class_type(id, Ctype.nondep_cltype_declaration env mid d, rs)
168-
:: rem'
165+
| Sig_class () -> assert false
166+
| Sig_class_type () -> assert false
169167

170168
and nondep_modtype_decl env mtd =
171169
{mtd with mtd_type = Misc.may_map (nondep_mty env Strict) mtd.mtd_type}

jscomp/ml/printtyp.ml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1295,8 +1295,7 @@ and trees_of_sigitem = function
12951295
[tree_of_modtype_declaration id decl]
12961296
| Sig_class() ->
12971297
[]
1298-
| Sig_class_type(id, decl, rs) ->
1299-
[tree_of_cltype_declaration id decl rs]
1298+
| Sig_class_type() -> []
13001299

13011300
and tree_of_modtype_declaration id decl =
13021301
let mty =

jscomp/ml/subst.ml

+3-6
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,7 @@ let rec rename_bound_idents s idents = function
381381
let id' = Ident.rename id in
382382
rename_bound_idents (add_modtype id (Mty_ident(Pident id')) s)
383383
(id' :: idents) sg
384-
| Sig_class_type(id, _, _) :: sg ->
385-
(* cheat and pretend they are types cf. PR#6650 *)
386-
let id' = Ident.rename id in
387-
rename_bound_idents (add_type id (Pident id') s) (id' :: idents) sg
384+
| Sig_class_type () :: _ -> assert false
388385
| (Sig_value(id, _) | Sig_typext(id, _, _)) :: sg ->
389386
let id' = Ident.rename id in
390387
rename_bound_idents s (id' :: idents) sg
@@ -430,8 +427,8 @@ and signature_component s comp newid =
430427
Sig_modtype(newid, modtype_declaration s d)
431428
| Sig_class() ->
432429
Sig_class()
433-
| Sig_class_type(_id, d, rs) ->
434-
Sig_class_type(newid, cltype_declaration s d, rs)
430+
| Sig_class_type () ->
431+
Sig_class_type ()
435432

436433
and module_declaration s decl =
437434
{

jscomp/ml/types.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ and signature_item =
261261
| Sig_module of Ident.t * module_declaration * rec_status
262262
| Sig_modtype of Ident.t * modtype_declaration
263263
| Sig_class of unit
264-
| Sig_class_type of Ident.t * class_type_declaration * rec_status
264+
| Sig_class_type of unit (* Dummy AST node *)
265265

266266
and module_declaration =
267267
{

jscomp/ml/types.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ and signature_item =
413413
| Sig_module of Ident.t * module_declaration * rec_status
414414
| Sig_modtype of Ident.t * modtype_declaration
415415
| Sig_class of unit
416-
| Sig_class_type of Ident.t * class_type_declaration * rec_status
416+
| Sig_class_type of unit (* Dummy AST node *)
417417

418418
and module_declaration =
419419
{

0 commit comments

Comments
 (0)