Skip to content

Commit dda9693

Browse files
committed
Remove class_type and dead code.
1 parent 8aa5f8d commit dda9693

13 files changed

+11
-153
lines changed

jscomp/frontend/bs_ast_mapper.ml

-20
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ type mapper = {
2929
attributes: mapper -> attribute list -> attribute list;
3030
case: mapper -> case -> case;
3131
cases: mapper -> case list -> case list;
32-
class_type: mapper -> class_type -> class_type;
3332
constructor_declaration:
3433
mapper -> constructor_declaration -> constructor_declaration;
3534
expr: mapper -> expression -> expression;
@@ -185,24 +184,6 @@ module T = struct
185184
~attrs:(sub.attributes sub pext_attributes)
186185
end
187186

188-
module CT = struct
189-
(* Type expressions for the class language *)
190-
191-
let map sub {pcty_loc = loc; pcty_desc = desc; pcty_attributes = attrs} =
192-
let open Cty in
193-
let loc = sub.location sub loc in
194-
let attrs = sub.attributes sub attrs in
195-
match desc with
196-
| Pcty_constr (lid, tys) ->
197-
constr ~loc ~attrs (map_loc sub lid) (List.map (sub.typ sub) tys)
198-
| Pcty_signature () -> assert false
199-
| Pcty_arrow (lab, t, ct) ->
200-
arrow ~loc ~attrs lab (sub.typ sub t) (sub.class_type sub ct)
201-
| Pcty_extension x -> extension ~loc ~attrs (sub.extension sub x)
202-
| Pcty_open (ovf, lid, ct) ->
203-
open_ ~loc ~attrs ovf (map_loc sub lid) (sub.class_type sub ct)
204-
end
205-
206187
module MT = struct
207188
(* Type expressions for the module language *)
208189

@@ -449,7 +430,6 @@ let default_mapper =
449430
signature_item = MT.map_signature_item;
450431
module_type = MT.map;
451432
with_constraint = MT.map_with_constraint;
452-
class_type = CT.map;
453433
type_declaration = T.map_type_declaration;
454434
(* #if true then *)
455435
type_declaration_list = T.map_type_declaration_list;

jscomp/frontend/bs_ast_mapper.mli

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ type mapper = {
5757
attributes: mapper -> attribute list -> attribute list;
5858
case: mapper -> case -> case;
5959
cases: mapper -> case list -> case list;
60-
class_type: mapper -> class_type -> class_type;
6160
constructor_declaration:
6261
mapper -> constructor_declaration -> constructor_declaration;
6362
expr: mapper -> expression -> expression;

jscomp/ml/ast_helper.ml

-17
Original file line numberDiff line numberDiff line change
@@ -271,23 +271,6 @@ module Str = struct
271271
f_txt
272272
end
273273

274-
275-
module Cty = struct
276-
let mk ?(loc = !default_loc) ?(attrs = []) d =
277-
{
278-
pcty_desc = d;
279-
pcty_loc = loc;
280-
pcty_attributes = attrs;
281-
}
282-
let attr d a = {d with pcty_attributes = d.pcty_attributes @ [a]}
283-
284-
let constr ?loc ?attrs a b = mk ?loc ?attrs (Pcty_constr (a, b))
285-
let arrow ?loc ?attrs a b c = mk ?loc ?attrs (Pcty_arrow (a, b, c))
286-
let extension ?loc ?attrs a = mk ?loc ?attrs (Pcty_extension a)
287-
let open_ ?loc ?attrs a b c = mk ?loc ?attrs (Pcty_open (a, b, c))
288-
end
289-
290-
291274
module Val = struct
292275
let mk ?(loc = !default_loc) ?(attrs = []) ?(docs = empty_docs)
293276
?(prim = []) name typ =

jscomp/ml/ast_helper.mli

-17
Original file line numberDiff line numberDiff line change
@@ -332,20 +332,3 @@ module Vb:
332332
val mk: ?loc: loc -> ?attrs:attrs -> ?docs:docs -> ?text:text ->
333333
pattern -> expression -> value_binding
334334
end
335-
336-
337-
(** {1 Class language} *)
338-
339-
(** Class type expressions *)
340-
module Cty:
341-
sig
342-
val mk: ?loc:loc -> ?attrs:attrs -> class_type_desc -> class_type
343-
val attr: class_type -> attribute -> class_type
344-
345-
val constr: ?loc:loc -> ?attrs:attrs -> lid -> core_type list -> class_type
346-
val arrow: ?loc:loc -> ?attrs:attrs -> arg_label -> core_type ->
347-
class_type -> class_type
348-
val extension: ?loc:loc -> ?attrs:attrs -> extension -> class_type
349-
val open_: ?loc:loc -> ?attrs:attrs -> override_flag -> lid -> class_type
350-
-> class_type
351-
end

jscomp/ml/ast_iterator.ml

-18
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ type iterator = {
2929
attributes: iterator -> attribute list -> unit;
3030
case: iterator -> case -> unit;
3131
cases: iterator -> case list -> unit;
32-
class_type: iterator -> class_type -> unit;
3332
constructor_declaration: iterator -> constructor_declaration -> unit;
3433
expr: iterator -> expression -> unit;
3534
extension: iterator -> extension -> unit;
@@ -165,22 +164,6 @@ module T = struct
165164

166165
end
167166

168-
module CT = struct
169-
(* Type expressions for the class language *)
170-
171-
let iter sub {pcty_loc = loc; pcty_desc = desc; pcty_attributes = attrs} =
172-
sub.location sub loc;
173-
sub.attributes sub attrs;
174-
match desc with
175-
| Pcty_constr (lid, tys) ->
176-
iter_loc sub lid; List.iter (sub.typ sub) tys
177-
| Pcty_signature () -> assert false
178-
| Pcty_arrow (_lab, t, ct) ->
179-
sub.typ sub t; sub.class_type sub ct
180-
| Pcty_extension x -> sub.extension sub x
181-
| Pcty_open (_ovf, lid, e) ->
182-
iter_loc sub lid; sub.class_type sub e
183-
end
184167

185168
module MT = struct
186169
(* Type expressions for the module language *)
@@ -397,7 +380,6 @@ let default_iterator =
397380
signature_item = MT.iter_signature_item;
398381
module_type = MT.iter;
399382
with_constraint = MT.iter_with_constraint;
400-
class_type = CT.iter;
401383
type_declaration = T.iter_type_declaration;
402384
type_kind = T.iter_type_kind;
403385
typ = T.iter;

jscomp/ml/ast_iterator.mli

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ type iterator = {
2626
attributes: iterator -> attribute list -> unit;
2727
case: iterator -> case -> unit;
2828
cases: iterator -> case list -> unit;
29-
class_type: iterator -> class_type -> unit;
3029
constructor_declaration: iterator -> constructor_declaration -> unit;
3130
expr: iterator -> expression -> unit;
3231
extension: iterator -> extension -> unit;

jscomp/ml/ast_mapper.ml

-20
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ type mapper = {
3030
attributes: mapper -> attribute list -> attribute list;
3131
case: mapper -> case -> case;
3232
cases: mapper -> case list -> case list;
33-
class_type: mapper -> class_type -> class_type;
3433
constructor_declaration: mapper -> constructor_declaration
3534
-> constructor_declaration;
3635
expr: mapper -> expression -> expression;
@@ -172,24 +171,6 @@ module T = struct
172171

173172
end
174173

175-
module CT = struct
176-
(* Type expressions for the class language *)
177-
178-
let map sub {pcty_loc = loc; pcty_desc = desc; pcty_attributes = attrs} =
179-
let open Cty in
180-
let loc = sub.location sub loc in
181-
let attrs = sub.attributes sub attrs in
182-
match desc with
183-
| Pcty_constr (lid, tys) ->
184-
constr ~loc ~attrs (map_loc sub lid) (List.map (sub.typ sub) tys)
185-
| Pcty_signature () -> assert false
186-
| Pcty_arrow (lab, t, ct) ->
187-
arrow ~loc ~attrs lab (sub.typ sub t) (sub.class_type sub ct)
188-
| Pcty_extension x -> extension ~loc ~attrs (sub.extension sub x)
189-
| Pcty_open (ovf, lid, ct) ->
190-
open_ ~loc ~attrs ovf (map_loc sub lid) (sub.class_type sub ct)
191-
end
192-
193174
module MT = struct
194175
(* Type expressions for the module language *)
195176

@@ -414,7 +395,6 @@ let default_mapper =
414395
signature_item = MT.map_signature_item;
415396
module_type = MT.map;
416397
with_constraint = MT.map_with_constraint;
417-
class_type = CT.map;
418398
type_declaration = T.map_type_declaration;
419399
type_kind = T.map_type_kind;
420400
typ = T.map;

jscomp/ml/ast_mapper.mli

-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ type mapper = {
5757
attributes: mapper -> attribute list -> attribute list;
5858
case: mapper -> case -> case;
5959
cases: mapper -> case list -> case list;
60-
class_type: mapper -> class_type -> class_type;
6160
constructor_declaration: mapper -> constructor_declaration
6261
-> constructor_declaration;
6362
expr: mapper -> expression -> expression;

jscomp/ml/parser.ml

+8-9
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ let mkmty ?attrs d = Mty.mk ~loc:(symbol_rloc()) ?attrs d
136136
let mksig d = Sig.mk ~loc:(symbol_rloc()) d
137137
let mkmod ?attrs d = Mod.mk ~loc:(symbol_rloc()) ?attrs d
138138
let mkstr d = Str.mk ~loc:(symbol_rloc()) d
139-
let mkcty ?attrs d = Cty.mk ~loc:(symbol_rloc()) ?attrs d
139+
let mkcty ?attrs _d = let _ = attrs in assert false
140140
let mkctf ?attrs ?docs _d = let _ = (attrs, docs) in assert false
141141
let mkcf ?attrs ?docs _d = let _ = (attrs, docs) in assert false
142142

@@ -319,8 +319,7 @@ let wrap_pat_attrs pat (ext, attrs) =
319319
let mkpat_attrs d attrs =
320320
wrap_pat_attrs (mkpat d) attrs
321321

322-
let wrap_class_type_attrs body attrs =
323-
{body with pcty_attributes = attrs @ body.pcty_attributes}
322+
let wrap_class_type_attrs _body _attrs = assert false
324323
let wrap_mod_attrs body attrs =
325324
{body with pmod_attributes = attrs @ body.pmod_attributes}
326325
let wrap_mty_attrs body attrs =
@@ -7394,22 +7393,22 @@ let yyact = [|
73947393
let _4 = (Parsing.peek_val __caml_parser_env 0 : 'clty_longident) in
73957394
Obj.repr(
73967395
# 965 "ml/parser.mly"
7397-
( mkcty(Pcty_constr (mkloc _4 (rhs_loc 4), List.rev _2)) )
7396+
( mkcty(assert false) )
73987397
# 7403 "ml/parser.ml"
73997398
: 'class_signature))
74007399
; (fun __caml_parser_env ->
74017400
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'clty_longident) in
74027401
Obj.repr(
74037402
# 967 "ml/parser.mly"
7404-
( mkcty(Pcty_constr (mkrhs _1 1, [])) )
7403+
( mkcty(assert false) )
74057404
# 7410 "ml/parser.ml"
74067405
: 'class_signature))
74077406
; (fun __caml_parser_env ->
74087407
let _2 = (Parsing.peek_val __caml_parser_env 2 : 'attributes) in
74097408
let _3 = (Parsing.peek_val __caml_parser_env 1 : 'class_sig_body) in
74107409
Obj.repr(
74117410
# 969 "ml/parser.mly"
7412-
( mkcty ~attrs:_2 (Pcty_signature _3) )
7411+
( mkcty ~attrs:_2 (assert false) )
74137412
# 7418 "ml/parser.ml"
74147413
: 'class_signature))
74157414
; (fun __caml_parser_env ->
@@ -7425,14 +7424,14 @@ let yyact = [|
74257424
let _2 = (Parsing.peek_val __caml_parser_env 0 : 'attribute) in
74267425
Obj.repr(
74277426
# 973 "ml/parser.mly"
7428-
( Cty.attr _1 _2 )
7427+
( assert false )
74297428
# 7434 "ml/parser.ml"
74307429
: 'class_signature))
74317430
; (fun __caml_parser_env ->
74327431
let _1 = (Parsing.peek_val __caml_parser_env 0 : 'extension) in
74337432
Obj.repr(
74347433
# 975 "ml/parser.mly"
7435-
( mkcty(Pcty_extension _1) )
7434+
( mkcty(assert false) )
74367435
# 7441 "ml/parser.ml"
74377436
: 'class_signature))
74387437
; (fun __caml_parser_env ->
@@ -7442,7 +7441,7 @@ let yyact = [|
74427441
let _7 = (Parsing.peek_val __caml_parser_env 0 : 'class_signature) in
74437442
Obj.repr(
74447443
# 977 "ml/parser.mly"
7445-
( wrap_class_type_attrs (mkcty(Pcty_open(_3, mkrhs _5 5, _7))) _4 )
7444+
( wrap_class_type_attrs (mkcty(assert false)) _4 )
74467445
# 7451 "ml/parser.ml"
74477446
: 'class_signature))
74487447
; (fun __caml_parser_env ->

jscomp/ml/parser.mly

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ let mkmty ?attrs d = Mty.mk ~loc:(symbol_rloc()) ?attrs d
3030
let mksig d = Sig.mk ~loc:(symbol_rloc()) d
3131
let mkmod ?attrs d = Mod.mk ~loc:(symbol_rloc()) ?attrs d
3232
let mkstr d = Str.mk ~loc:(symbol_rloc()) d
33-
let mkcty ?attrs d = Cty.mk ~loc:(symbol_rloc()) ?attrs d
33+
let mkcty ?attrs _d = let _ = attrs in assert false
3434
let mkctf ?attrs ?docs d = let _ = (attrs, docs) in assert false
3535
let mkcf ?attrs ?docs d = assert false
3636

@@ -213,8 +213,7 @@ let wrap_pat_attrs pat (ext, attrs) =
213213
let mkpat_attrs d attrs =
214214
wrap_pat_attrs (mkpat d) attrs
215215

216-
let wrap_class_type_attrs body attrs =
217-
{body with pcty_attributes = attrs @ body.pcty_attributes}
216+
let wrap_class_type_attrs _body _attrs = assert false
218217
let wrap_mod_attrs body attrs =
219218
{body with pmod_attributes = attrs @ body.pmod_attributes}
220219
let wrap_mty_attrs body attrs =
@@ -966,7 +965,7 @@ class_signature:
966965
| OBJECT attributes class_sig_body error
967966
{ unclosed "object" 1 "end" 4 }
968967
| class_signature attribute
969-
{ Cty.attr $1 $2 }
968+
{ assert false }
970969
| extension
971970
{ mkcty(Pcty_extension $1) }
972971
| LET OPEN override_flag attributes mod_longident IN class_signature

jscomp/ml/parsetree.ml

-26
Original file line numberDiff line numberDiff line change
@@ -481,32 +481,6 @@ and extension_constructor_kind =
481481
| C = D
482482
*)
483483

484-
(** {1 Class language} *)
485-
486-
(* Type expressions for the class language *)
487-
488-
and class_type =
489-
{
490-
pcty_desc: class_type_desc;
491-
pcty_loc: Location.t;
492-
pcty_attributes: attributes; (* ... [@id1] [@id2] *)
493-
}
494-
495-
and class_type_desc =
496-
| Pcty_constr of Longident.t loc * core_type list
497-
(* c
498-
['a1, ..., 'an] c *)
499-
| Pcty_signature of unit
500-
(* dummy AST node *)
501-
| Pcty_arrow of arg_label * core_type * class_type
502-
(* T -> CT Simple
503-
~l:T -> CT Labelled l
504-
?l:T -> CT Optional l
505-
*)
506-
| Pcty_extension of extension
507-
(* [%id] *)
508-
| Pcty_open of override_flag * Longident.t loc * class_type
509-
(* let open M in CT *)
510484

511485
(** {1 Module language} *)
512486

jscomp/ml/untypeast.ml

-18
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ type mapper = {
2525
attributes: mapper -> T.attribute list -> attribute list;
2626
case: mapper -> T.case -> case;
2727
cases: mapper -> T.case list -> case list;
28-
class_type: mapper -> T.class_type -> class_type;
2928
constructor_declaration: mapper -> T.constructor_declaration
3029
-> constructor_declaration;
3130
expr: mapper -> T.expression -> expression;
@@ -571,22 +570,6 @@ let module_expr sub mexpr =
571570
Mod.mk ~loc ~attrs desc
572571

573572

574-
575-
let class_type sub ct =
576-
let loc = sub.location sub ct.cltyp_loc in
577-
let attrs = sub.attributes sub ct.cltyp_attributes in
578-
let desc = match ct.cltyp_desc with
579-
Tcty_signature _ -> assert false
580-
| Tcty_constr (_path, lid, list) ->
581-
Pcty_constr (map_loc sub lid, List.map (sub.typ sub) list)
582-
| Tcty_arrow (label, ct, cl) ->
583-
Pcty_arrow (label, sub.typ sub ct, sub.class_type sub cl)
584-
| Tcty_open (ovf, _p, lid, _env, e) ->
585-
Pcty_open (ovf, lid, sub.class_type sub e)
586-
in
587-
Cty.mk ~loc ~attrs desc
588-
589-
590573
let core_type sub ct =
591574
let loc = sub.location sub ct.ctyp_loc in
592575
let attrs = sub.attributes sub ct.ctyp_attributes in
@@ -643,7 +626,6 @@ let default_mapper =
643626
signature_item = signature_item;
644627
module_type = module_type;
645628
with_constraint = with_constraint;
646-
class_type = class_type;
647629
type_declaration = type_declaration;
648630
type_kind = type_kind;
649631
typ = core_type;

jscomp/ml/untypeast.mli

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ type mapper = {
2222
attributes: mapper -> Typedtree.attribute list -> attribute list;
2323
case: mapper -> Typedtree.case -> case;
2424
cases: mapper -> Typedtree.case list -> case list;
25-
class_type: mapper -> Typedtree.class_type -> class_type;
2625
constructor_declaration: mapper -> Typedtree.constructor_declaration
2726
-> constructor_declaration;
2827
expr: mapper -> Typedtree.expression -> expression;

0 commit comments

Comments
 (0)