From 9ff6cd988a2e1351e1f4ef5d0fa6ad7ba15ee935 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Sun, 28 Jan 2024 18:45:52 +0200 Subject: [PATCH] * SymInfoPair type converted back to a non-ref object --- compiler/modulegraphs.nim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/modulegraphs.nim b/compiler/modulegraphs.nim index 6c511776b91ba..355b1afd699a1 100644 --- a/compiler/modulegraphs.nim +++ b/compiler/modulegraphs.nim @@ -55,7 +55,7 @@ type concreteTypes*: seq[FullId] inst*: PInstantiation - SymInfoPair* = ref object + SymInfoPair* = object sym*: PSym info*: TLineInfo isDecl*: bool @@ -745,7 +745,7 @@ 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( @@ -753,9 +753,10 @@ proc findSymInfo*(s: var SuggestFileSymbolDatabase; li: TLineInfo): SymInfoPair ) 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