@@ -208,34 +208,19 @@ let mkGraph (files: FileWithAST array) : Graph<int> =
208208
209209 let fileContents = Array.Parallel.map FileContentMapping.mkFileContent files
210210
211- let filesWithAutoOpen =
212- Array.choose
213- ( fun f ->
214- if AlwaysLinkDetection.doesFileHasAutoOpenBehavior f.AST then
215- Some f.Idx
216- else
217- None)
218- trieInput
219-
220211 let findDependencies ( file : FileWithAST ) : int * int array =
221212 let fileContent = fileContents.[ file.Idx]
222213 let knownFiles = getFileNameBefore files file.Idx
214+ let filesFromRoot = trie.Files |> Set.filter ( fun rootIdx -> rootIdx < file.Idx)
223215
224216 // Process all entries of a file and query the trie when required to find the dependent files.
225217 let result =
226218 // Seq is faster than List in this case.
227- Seq.fold ( processStateEntry queryTrie) ( FileContentQueryState.Create file.Idx knownFiles) fileContent
219+ Seq.fold ( processStateEntry queryTrie) ( FileContentQueryState.Create file.Idx knownFiles filesFromRoot ) fileContent
228220
229221 // after processing the file we should verify if any of the open statements are found in the trie but do not yield any file link.
230222 let ghostDependencies = collectGhostDependencies file.Idx trie queryTrie result
231223
232- // Automatically add all files that came before the current file that use the [<AutoOpen>] attribute.
233- let topLevelAutoOpenFiles =
234- if Array.isEmpty filesWithAutoOpen then
235- Array.empty
236- else
237- [| 0 .. ( file.Idx - 1 ) |]. Intersect( filesWithAutoOpen) .ToArray()
238-
239224 // Automatically add a link from an implementation to its signature file (if present)
240225 let signatureDependency =
241226 match Map.tryFind file.Idx implToSig with
@@ -246,7 +231,6 @@ let mkGraph (files: FileWithAST array) : Graph<int> =
246231 [|
247232 yield ! result.FoundDependencies
248233 yield ! ghostDependencies
249- yield ! topLevelAutoOpenFiles
250234 yield ! signatureDependency
251235 |]
252236 |> Array.distinct
0 commit comments