@@ -379,6 +379,8 @@ let rec pathFromVisibility visibilityPath current =
379
379
let pathFromVisibility visibilityPath tipName =
380
380
pathFromVisibility visibilityPath (Tip tipName)
381
381
382
+ type references = {uri : Uri2 .t ; locs : Location .t list }
383
+
382
384
let forLocalStamp ~full :{file; extra; package} stamp tip =
383
385
let env = QueryEnv. fromFile file in
384
386
let open Infix in
@@ -392,7 +394,7 @@ let forLocalStamp ~full:{file; extra; package} stamp tip =
392
394
| Some localStamp -> (
393
395
match Hashtbl. find_opt extra.internalReferences localStamp with
394
396
| None -> []
395
- | Some local ->
397
+ | Some locs ->
396
398
maybeLog (" Checking externals: " ^ string_of_int stamp);
397
399
let externals =
398
400
match declaredForTip ~stamps: env.file.stamps stamp tip with
@@ -416,7 +418,7 @@ let forLocalStamp ~full:{file; extra; package} stamp tip =
416
418
Hashtbl. find_opt extra.internalReferences localStamp
417
419
with
418
420
| None -> []
419
- | Some local -> [( file.uri, local) ]))
421
+ | Some local -> [{uri = file.uri; locs = local} ]))
420
422
(* if this file has a corresponding interface or implementation file
421
423
also find the references in that file *)
422
424
in
@@ -441,20 +443,20 @@ let forLocalStamp ~full:{file; extra; package} stamp tip =
441
443
with
442
444
| None -> None
443
445
| Some refs ->
444
- let refs =
446
+ let locs =
445
447
refs
446
- |> Utils. filterMap (fun (p , t , l ) ->
447
- if p = path && t = tip then Some l
448
+ |> Utils. filterMap (fun (p , t , locs ) ->
449
+ if p = path && t = tip then Some locs
448
450
else None )
449
451
in
450
- Some ( file.uri, refs) )))
452
+ Some {uri = file.uri; locs} )))
451
453
in
452
454
alternativeReferences @ externals)
453
455
else (
454
456
maybeLog " Not visible" ;
455
457
[] )
456
458
in
457
- ( file.uri, local) :: externals)
459
+ {uri = file.uri; locs} :: externals)
458
460
459
461
let allReferencesForLocItem ~full :({file; package} as full ) locItem =
460
462
match locItem.locType with
@@ -471,14 +473,23 @@ let allReferencesForLocItem ~full:({file; package} as full) locItem =
471
473
| Some locs ->
472
474
locs |> LocationSet. elements
473
475
|> List. map (fun loc ->
474
- (Uri2. fromPath loc.Location. loc_start.pos_fname, [loc])))
476
+ {
477
+ uri = Uri2. fromPath loc.Location. loc_start.pos_fname;
478
+ locs = [loc];
479
+ }))
475
480
|> List. flatten
476
481
in
477
482
let targetModuleReferences =
478
483
match Hashtbl. find_opt package.pathsForModule moduleName with
479
484
| None -> []
480
485
| Some paths ->
481
- let moduleSrcToRef src = (Uri2. fromPath src, [Utils. topLoc src]) in
486
+ let moduleSrcToRef src =
487
+ {
488
+ uri = Uri2. fromPath src;
489
+ (* XXX TODO use different runtime representation *)
490
+ locs = [Utils. topLoc src];
491
+ }
492
+ in
482
493
getSrc paths |> List. map moduleSrcToRef
483
494
in
484
495
List. append targetModuleReferences otherModulesReferences
0 commit comments