Skip to content

Commit 071f0de

Browse files
committed
Refactor forLocalStamp.
1 parent 34eb499 commit 071f0de

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

analysis/.depend

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
src/BuildSystem.cmx : src/ModuleResolution.cmx src/Log.cmx src/Infix.cmx \
22
src/Files.cmx
33
src/Cli.cmx : src/Commands.cmx
4-
src/Commands.cmx : src/Utils.cmx src/Uri2.cmx src/TopTypes.cmx \
5-
src/SharedTypes.cmx src/Shared.cmx src/References.cmx src/Protocol.cmx \
6-
src/ProcessCmt.cmx src/NewCompletions.cmx src/Hover.cmx src/Files.cmx
4+
src/Commands.cmx : src/Utils.cmx src/Uri2.cmx src/SharedTypes.cmx \
5+
src/Shared.cmx src/References.cmx src/Protocol.cmx src/ProcessCmt.cmx \
6+
src/NewCompletions.cmx src/Hover.cmx src/Files.cmx
77
src/Files.cmx :
88
src/FindFiles.cmx : src/Utils.cmx src/SharedTypes.cmx \
99
src/ModuleResolution.cmx src/Log.cmx src/vendor/Json.cmx src/Infix.cmx \

analysis/src/Commands.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ let definition ~path ~line ~col =
133133
print_endline result
134134

135135
let references ~file ~line ~col ~extra ~package =
136-
let open TopTypes in
137136
let locations =
138137
extra.SharedTypes.locations
139138
|> List.filter (fun (l, _) -> not l.Location.loc_ghost)
@@ -145,7 +144,7 @@ let references ~file ~line ~col ~extra ~package =
145144
| Some (_, loc) ->
146145
let allReferences =
147146
References.allReferencesForLoc ~package ~file ~extra
148-
~allModules:package.localModules ~getUri:ProcessCmt.fileForUri
147+
~getUri:ProcessCmt.fileForUri
149148
~getExtra:(ProcessCmt.extraForModule ~package)
150149
loc
151150
in

analysis/src/References.ml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ let rec pathFromVisibility visibilityPath current =
369369
let pathFromVisibility visibilityPath tipName =
370370
pathFromVisibility visibilityPath (Tip tipName)
371371

372-
let forLocalStamp ~package ~file ~extra ~allModules ~getExtra stamp tip =
372+
let forLocalStamp ~package ~file ~extra ~getExtra stamp tip =
373373
let env = ProcessCmt.fileEnv file in
374374
let open Infix in
375375
match
@@ -416,7 +416,7 @@ let forLocalStamp ~package ~file ~extra ~allModules ~getExtra stamp tip =
416416
maybeLog ("Now checking path " ^ pathToString path);
417417
let thisModuleName = file.moduleName in
418418
let externals =
419-
allModules
419+
package.localModules
420420
|> List.filter (fun name -> name <> file.moduleName)
421421
|> Utils.filterMap (fun name ->
422422
match ProcessCmt.fileForModule ~package name with
@@ -447,22 +447,21 @@ let forLocalStamp ~package ~file ~extra ~allModules ~getExtra stamp tip =
447447
in
448448
(file.uri, local) :: externals)
449449

450-
let allReferencesForLoc ~package ~getUri ~file ~extra ~allModules ~getExtra loc
451-
=
450+
let allReferencesForLoc ~package ~getUri ~file ~extra ~getExtra loc =
452451
match loc with
453452
| Explanation _
454453
| Typed (_, NotFound)
455454
| LModule NotFound
456455
| TopLevelModule _ | Constant _ ->
457456
[]
458457
| TypeDefinition (_, _, stamp) ->
459-
forLocalStamp ~package ~file ~extra ~allModules ~getExtra stamp Type
458+
forLocalStamp ~package ~file ~extra ~getExtra stamp Type
460459
| Typed (_, (LocalReference (stamp, tip) | Definition (stamp, tip)))
461460
| LModule (LocalReference (stamp, tip) | Definition (stamp, tip)) ->
462461
maybeLog
463462
("Finding references for " ^ Uri2.toString file.uri ^ " and stamp "
464463
^ string_of_int stamp ^ " and tip " ^ tipToString tip);
465-
forLocalStamp ~package ~file ~extra ~allModules ~getExtra stamp tip
464+
forLocalStamp ~package ~file ~extra ~getExtra stamp tip
466465
| LModule (GlobalReference (moduleName, path, tip))
467466
| Typed (_, GlobalReference (moduleName, path, tip)) -> (
468467
match ProcessCmt.fileForModule ~package moduleName with
@@ -482,5 +481,4 @@ let allReferencesForLoc ~package ~getUri ~file ~extra ~allModules ~getExtra loc
482481
("Finding references for (global) " ^ Uri2.toString env.file.uri
483482
^ " and stamp " ^ string_of_int stamp ^ " and tip "
484483
^ tipToString tip);
485-
forLocalStamp ~package ~file ~extra ~allModules ~getExtra stamp tip)
486-
)))
484+
forLocalStamp ~package ~file ~extra ~getExtra stamp tip))))

0 commit comments

Comments
 (0)