Skip to content

Commit

Permalink
* SymInfoPair type converted back to a non-ref object
Browse files Browse the repository at this point in the history
  • Loading branch information
nickysn committed Jan 28, 2024
1 parent 588fbf5 commit 9ff6cd9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions compiler/modulegraphs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type
concreteTypes*: seq[FullId]
inst*: PInstantiation

SymInfoPair* = ref object
SymInfoPair* = object
sym*: PSym
info*: TLineInfo
isDecl*: bool
Expand Down Expand Up @@ -745,17 +745,18 @@ proc add*(s: var SuggestFileSymbolDatabase; v: SymInfoPair) =
proc add*(s: var SuggestSymbolDatabase; v: SymInfoPair) =
s.mgetOrPut(v.info.fileIndex, newSuggestFileSymbolDatabase()).add(v)

proc findSymInfo*(s: var SuggestFileSymbolDatabase; li: TLineInfo): SymInfoPair =
proc findSymInfo*(s: var SuggestFileSymbolDatabase; li: TLineInfo): ref SymInfoPair =
if not s.isSorted:
s.sort()
var q = SymInfoPair(
info: li
)
var idx = binarySearch(s.items, q, cmp)
if idx != -1:
return s.items[idx]
new(result)
result[] = s.items[idx]
else:
return nil
result = nil

proc fileSymbols*(graph: ModuleGraph, fileIdx: FileIndex): seq[SymInfoPair] =
result = graph.suggestSymbols.getOrDefault(fileIdx, newSuggestFileSymbolDatabase()).items
Expand Down

0 comments on commit 9ff6cd9

Please sign in to comment.