Skip to content

Commit 45a319b

Browse files
committed
Remove class stuff from Tast_iterator
1 parent 5b7701d commit 45a319b

File tree

2 files changed

+4
-53
lines changed

2 files changed

+4
-53
lines changed

compiler/ml/tast_iterator.ml

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ open Typedtree
1919
type iterator = {
2020
case : iterator -> case -> unit;
2121
cases : iterator -> case list -> unit;
22-
class_description : iterator -> class_description -> unit;
23-
class_signature : iterator -> class_signature -> unit;
24-
class_type : iterator -> class_type -> unit;
25-
class_type_declaration : iterator -> class_type_declaration -> unit;
26-
class_type_field : iterator -> class_type_field -> unit;
2722
env : iterator -> Env.t -> unit;
2823
expr : iterator -> expression -> unit;
2924
extension_constructor : iterator -> extension_constructor -> unit;
@@ -56,16 +51,11 @@ let structure sub {str_items; str_final_env; _} =
5651
List.iter (sub.structure_item sub) str_items;
5752
sub.env sub str_final_env
5853

59-
let class_infos sub f x =
60-
List.iter (fun (ct, _) -> sub.typ sub ct) x.ci_params;
61-
f x.ci_expr
62-
6354
let module_type_declaration sub {mtd_type; _} =
6455
Option.iter (sub.module_type sub) mtd_type
6556

6657
let module_declaration sub {md_type; _} = sub.module_type sub md_type
6758
let include_infos f {incl_mod; _} = f incl_mod
68-
let class_type_declaration sub x = class_infos sub (sub.class_type sub) x
6959

7060
let structure_item sub {str_desc; str_env; _} =
7161
sub.env sub str_env;
@@ -80,8 +70,7 @@ let structure_item sub {str_desc; str_env; _} =
8070
| Tstr_recmodule list -> List.iter (sub.module_binding sub) list
8171
| Tstr_modtype x -> sub.module_type_declaration sub x
8272
| Tstr_class _ -> ()
83-
| Tstr_class_type list ->
84-
List.iter (fun (_, _, cltd) -> sub.class_type_declaration sub cltd) list
73+
| Tstr_class_type () -> ()
8574
| Tstr_include incl -> include_infos (sub.module_expr sub) incl
8675
| Tstr_open _ -> ()
8776
| Tstr_attribute _ -> ()
@@ -153,9 +142,7 @@ let pat sub {pat_extra; pat_desc; pat_env; _} =
153142
let expr sub {exp_extra; exp_desc; exp_env; _} =
154143
let extra = function
155144
| Texp_constraint cty -> sub.typ sub cty
156-
| Texp_coerce (cty1, cty2) ->
157-
Option.iter (sub.typ sub) cty1;
158-
sub.typ sub cty2
145+
| Texp_coerce ((), cty2) -> sub.typ sub cty2
159146
| Texp_newtype _ -> ()
160147
| Texp_poly cto -> Option.iter (sub.typ sub) cto
161148
| Texp_open (_, _, _, _) -> ()
@@ -245,12 +232,10 @@ let signature_item sub {sig_desc; sig_env; _} =
245232
| Tsig_modtype x -> sub.module_type_declaration sub x
246233
| Tsig_include incl -> include_infos (sub.module_type sub) incl
247234
| Tsig_class () -> ()
248-
| Tsig_class_type list -> List.iter (sub.class_type_declaration sub) list
235+
| Tsig_class_type () -> ()
249236
| Tsig_open _od -> ()
250237
| Tsig_attribute _ -> ()
251238

252-
let class_description sub x = class_infos sub (sub.class_type sub) x
253-
254239
let module_type sub {mty_desc; mty_env; _} =
255240
sub.env sub mty_env;
256241
match mty_desc with
@@ -305,30 +290,6 @@ let module_expr sub {mod_desc; mod_env; _} =
305290

306291
let module_binding sub {mb_expr; _} = sub.module_expr sub mb_expr
307292

308-
let class_type sub {cltyp_desc; cltyp_env; _} =
309-
sub.env sub cltyp_env;
310-
match cltyp_desc with
311-
| Tcty_signature csg -> sub.class_signature sub csg
312-
| Tcty_constr (_, _, list) -> List.iter (sub.typ sub) list
313-
| Tcty_arrow (_, ct, cl) ->
314-
sub.typ sub ct;
315-
sub.class_type sub cl
316-
| Tcty_open (_, _, _, _, e) -> sub.class_type sub e
317-
318-
let class_signature sub {csig_self; csig_fields; _} =
319-
sub.typ sub csig_self;
320-
List.iter (sub.class_type_field sub) csig_fields
321-
322-
let class_type_field sub {ctf_desc; _} =
323-
match ctf_desc with
324-
| Tctf_inherit ct -> sub.class_type sub ct
325-
| Tctf_val (_, _, _, ct) -> sub.typ sub ct
326-
| Tctf_method (_, _, _, ct) -> sub.typ sub ct
327-
| Tctf_constraint (ct1, ct2) ->
328-
sub.typ sub ct1;
329-
sub.typ sub ct2
330-
| Tctf_attribute _ -> ()
331-
332293
let typ sub {ctyp_desc; ctyp_env; _} =
333294
sub.env sub ctyp_env;
334295
match ctyp_desc with
@@ -340,7 +301,7 @@ let typ sub {ctyp_desc; ctyp_env; _} =
340301
| Ttyp_tuple list -> List.iter (sub.typ sub) list
341302
| Ttyp_constr (_, _, list) -> List.iter (sub.typ sub) list
342303
| Ttyp_object (list, _) -> List.iter (sub.object_field sub) list
343-
| Ttyp_class (_, _, list) -> List.iter (sub.typ sub) list
304+
| Ttyp_class () -> ()
344305
| Ttyp_alias (ct, _) -> sub.typ sub ct
345306
| Ttyp_variant (list, _, _) -> List.iter (sub.row_field sub) list
346307
| Ttyp_poly (_, ct) -> sub.typ sub ct
@@ -371,11 +332,6 @@ let default_iterator =
371332
{
372333
case;
373334
cases;
374-
class_description;
375-
class_signature;
376-
class_type;
377-
class_type_declaration;
378-
class_type_field;
379335
env;
380336
expr;
381337
extension_constructor;

compiler/ml/tast_iterator.mli

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ type iterator =
2424
{
2525
case: iterator -> case -> unit;
2626
cases: iterator -> case list -> unit;
27-
class_description: iterator -> class_description -> unit;
28-
class_signature: iterator -> class_signature -> unit;
29-
class_type: iterator -> class_type -> unit;
30-
class_type_declaration: iterator -> class_type_declaration -> unit;
31-
class_type_field: iterator -> class_type_field -> unit;
3227
env: iterator -> Env.t -> unit;
3328
expr: iterator -> expression -> unit;
3429
extension_constructor: iterator -> extension_constructor -> unit;

0 commit comments

Comments
 (0)