@@ -62,16 +62,20 @@ let getTypeAtPath = (~env, path) => {
62
62
| ` Exported (env , name ) =>
63
63
let res = {
64
64
let %opt stamp = Hashtbl.find_opt(env.exported.types, name);
65
- let %opt_wrap declaredType =
66
- Hashtbl . find_opt (env .file .stamps .types , stamp );
67
- ` Local (declaredType);
65
+ let declaredType = Hashtbl . find_opt(env. file. stamps. types, stamp);
66
+ switch (declaredType) {
67
+ | Some (declaredType ) => Some (` Local (declaredType))
68
+ | None => None
69
+ };
68
70
};
69
71
res |? ` Not_found ;
70
72
| ` Stamp (stamp ) =>
71
73
let res = {
72
- let %opt_wrap declaredType =
73
- Hashtbl . find_opt (env .file .stamps .types , stamp );
74
- ` Local (declaredType);
74
+ let declaredType = Hashtbl . find_opt(env. file. stamps. types, stamp);
75
+ switch (declaredType) {
76
+ | Some (declaredType ) => Some (` Local (declaredType))
77
+ | None => None
78
+ };
75
79
};
76
80
res |? ` Not_found ;
77
81
};
@@ -141,12 +145,12 @@ module F =
141
145
addExternalReference(moduleName, path, tip, identLoc);
142
146
GlobalReference (moduleName, path, tip);
143
147
| ` Exported (env , name ) =>
144
- let res = {
145
- let %opt_wrap stamp = Hashtbl.find_opt(env.exported.values, name);
148
+ switch ( Hashtbl . find_opt(env . exported . values , name)) {
149
+ | Some ( stamp ) =>
146
150
addReference(stamp, identLoc);
147
151
LocalReference (stamp, tip);
148
- } ;
149
- res |? NotFound ;
152
+ | None => NotFound
153
+ }
150
154
| ` GlobalMod (_ ) => NotFound
151
155
};
152
156
addLocation(loc, Typed (typ, locType));
@@ -166,12 +170,12 @@ module F =
166
170
addExternalReference(moduleName, path, Module , loc);
167
171
LModule (GlobalReference (moduleName, path, Module ));
168
172
| ` Exported (env , name ) =>
169
- let res = {
170
- let %opt_wrap stamp = Hashtbl.find_opt(env.exported.modules, name);
173
+ switch ( Hashtbl . find_opt(env . exported . modules , name)) {
174
+ | Some ( stamp ) =>
171
175
addReference(stamp, loc);
172
176
LModule (LocalReference (stamp, Module ));
173
- } ;
174
- res |? LModule ( NotFound ) ;
177
+ | None => LModule ( NotFound )
178
+ }
175
179
};
176
180
addLocation(loc, locType);
177
181
};
@@ -189,13 +193,12 @@ module F =
189
193
let locType =
190
194
switch (t) {
191
195
| ` Local ({stamp, item: {kind: Record (attributes )}}) =>
192
- {
193
- let %opt_wrap {stamp: astamp} =
194
- attributes |> List . find_opt (a => a .aname .txt == name );
196
+ switch (attributes |> List . find_opt(a => a. aname. txt == name)) {
197
+ | Some ({stamp: astamp }) =>
195
198
addReference(astamp, nameLoc);
196
199
LocalReference (stamp, Attribute (name));
200
+ | None => NotFound
197
201
}
198
- |? NotFound
199
202
| ` Global (moduleName , path ) =>
200
203
addExternalReference(moduleName, path, Attribute (name), nameLoc);
201
204
GlobalReference (moduleName, path, Attribute (name));
@@ -221,13 +224,12 @@ module F =
221
224
let locType =
222
225
switch (t) {
223
226
| ` Local ({stamp, item: {kind: Record (attributes )}}) =>
224
- {
225
- let %opt_wrap {stamp: astamp} =
226
- attributes |> List . find_opt (a => a .aname .txt == name );
227
+ switch (attributes |> List . find_opt(a => a. aname. txt == name)) {
228
+ | Some ({stamp: astamp }) =>
227
229
addReference(astamp, nameLoc);
228
230
LocalReference (stamp, Attribute (name));
231
+ | None => NotFound
229
232
}
230
- |? NotFound
231
233
| ` Global (moduleName , path ) =>
232
234
addExternalReference(
233
235
moduleName,
@@ -258,13 +260,12 @@ module F =
258
260
let locType =
259
261
switch (t) {
260
262
| ` Local ({stamp, item: {kind: Variant (constructors )}}) =>
261
- {
262
- let %opt_wrap {stamp: cstamp} =
263
- constructors |> List . find_opt (c => c .cname .txt == cstr_name );
263
+ switch (constructors |> List . find_opt(c => c. cname. txt == cstr_name)) {
264
+ | Some ({stamp: cstamp }) =>
264
265
addReference(cstamp, nameLoc);
265
266
LocalReference (stamp, Constructor (name));
267
+ | None => NotFound
266
268
}
267
- |? NotFound
268
269
| ` Global (moduleName , path ) =>
269
270
addExternalReference(moduleName, path, Constructor (name), nameLoc);
270
271
GlobalReference (moduleName, path, Constructor (name));
0 commit comments