1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# 1 "src/model/compat.cppo.ml"
type visibility =
| Exported
| Hidden
type module_type =
Mty_ident of Path.t
| Mty_signature of signature
| Mty_functor of functor_parameter * module_type
| Mty_alias of Path.t
and functor_parameter =
| Unit
| Named of Ident.t option * module_type
and module_presence =
| Mp_present
| Mp_absent
and signature = signature_item list
and signature_item =
Sig_value of Ident.t * Types.value_description * visibility
| Sig_type of Ident.t * Types.type_declaration * Types.rec_status * visibility
| Sig_typext of Ident.t * Types.extension_constructor * Types.ext_status * visibility
| Sig_module of
Ident.t * module_presence * module_declaration * Types.rec_status * visibility
| Sig_modtype of Ident.t * modtype_declaration * visibility
| Sig_class of Ident.t * Types.class_declaration * Types.rec_status * visibility
| Sig_class_type of Ident.t * Types.class_type_declaration * Types.rec_status * visibility
and module_declaration =
{
md_type: module_type;
md_attributes: Parsetree.attributes;
md_loc: Location.t;
}
and modtype_declaration =
{
mtd_type: module_type option;
mtd_attributes: Parsetree.attributes;
mtd_loc: Location.t;
}
let opt conv = function | None -> None | Some x -> Some (conv x)
# 76 "src/model/compat.cppo.ml"
let rec signature : Types.signature -> signature = fun x -> List.map signature_item x
and signature_item : Types.signature_item -> signature_item = function
| Types.Sig_value (a,b,c) -> Sig_value (a,b,visibility c)
| Types.Sig_type (a,b,c,d) -> Sig_type (a,b,c, visibility d)
| Types.Sig_typext (a,b,c,d) -> Sig_typext (a,b,c,visibility d)
| Types.Sig_module (a,b,c,d,e) -> Sig_module (a, module_presence b, module_declaration c, d, visibility e)
| Types.Sig_modtype (a,b,c) -> Sig_modtype (a, modtype_declaration b, visibility c)
| Types.Sig_class (a,b,c,d) -> Sig_class (a,b,c, visibility d)
| Types.Sig_class_type (a,b,c,d) -> Sig_class_type (a,b,c, visibility d)
and visibility : Types.visibility -> visibility = function
| Types.Hidden -> Hidden
| Types.Exported -> Exported
and module_type : Types.module_type -> module_type = function
| Types.Mty_ident p -> Mty_ident p
| Types.Mty_signature s -> Mty_signature (signature s)
| Types.Mty_functor (a, b) -> Mty_functor(functor_parameter a, module_type b)
| Types.Mty_alias p -> Mty_alias p
and functor_parameter : Types.functor_parameter -> functor_parameter = function
| Types.Unit -> Unit
| Types.Named (a,b) -> Named (a, module_type b)
and module_presence : Types.module_presence -> module_presence = function
| Types.Mp_present -> Mp_present
| Types.Mp_absent -> Mp_absent
and module_declaration : Types.module_declaration -> module_declaration = fun x ->
{ md_type = module_type x.Types.md_type;
md_attributes = x.md_attributes;
md_loc = x.md_loc }
and modtype_declaration : Types.modtype_declaration -> modtype_declaration = fun x ->
{ mtd_type = opt module_type x.Types.mtd_type;
mtd_attributes = x.Types.mtd_attributes;
mtd_loc = x.Types.mtd_loc }
# 227 "src/model/compat.cppo.ml"
# 231 "src/model/compat.cppo.ml"
type shape = Shape.t
type 'a shape_uid_map = 'a Shape.Uid.Map.t
type uid_to_loc = Warnings.loc Types.Uid.Tbl.t
let empty_map = Shape.Uid.Map.empty
# 243 "src/model/compat.cppo.ml"
let shape_info_of_cmt_infos : Cmt_format.cmt_infos -> (shape * uid_to_loc) option =
let loc_of_declaration =
let open Typedtree in
function
| Value v -> v.val_loc
| Value_binding vb -> vb.vb_pat.pat_loc
| Type t -> t.typ_loc
| Constructor c -> c.cd_loc
| Extension_constructor e -> e.ext_loc
| Label l -> l.ld_loc
| Module m -> m.md_loc
| Module_substitution ms -> ms.ms_loc
| Module_binding mb -> mb.mb_loc
| Module_type mt -> mt.mtd_loc
| Class cd -> cd.ci_id_name.loc
| Class_type ctd -> ctd.ci_id_name.loc
in
fun x -> Option.map (fun s -> (s, Shape.Uid.Tbl.map x.cmt_uid_to_decl loc_of_declaration)) x.cmt_impl_shape
# 277 "src/model/compat.cppo.ml"
let compunit_name : Cmo_format.compunit -> string = function | Compunit x -> x
let required_compunit_names x = List.map compunit_name x.Cmo_format.cu_required_compunits