handle invalid data in --def
This commit is contained in:
parent
11ee226192
commit
f0be93bfa2
1 changed files with 5 additions and 2 deletions
|
|
@ -272,6 +272,7 @@ proc addToSourceMap(sym: Psym, info: TLineInfo) =
|
||||||
gSourceMaps[info.fileIndex].lines[info.line].entries.add(TEntry(pos: info.col, sym: sym))
|
gSourceMaps[info.fileIndex].lines[info.line].entries.add(TEntry(pos: info.col, sym: sym))
|
||||||
|
|
||||||
proc defFromLine(entries: var seq[TEntry], col: int32) =
|
proc defFromLine(entries: var seq[TEntry], col: int32) =
|
||||||
|
if entries == nil: return
|
||||||
# The sorting is done lazily here on purpose.
|
# The sorting is done lazily here on purpose.
|
||||||
# No need to pay the price for it unless the user requests
|
# No need to pay the price for it unless the user requests
|
||||||
# "goto definition" on a particular line
|
# "goto definition" on a particular line
|
||||||
|
|
@ -288,8 +289,10 @@ proc defFromLine(entries: var seq[TEntry], col: int32) =
|
||||||
return
|
return
|
||||||
|
|
||||||
proc defFromSourceMap*(i: TLineInfo) =
|
proc defFromSourceMap*(i: TLineInfo) =
|
||||||
InternalAssert i.fileIndex < gSourceMaps.len and
|
if not ((i.fileIndex < gSourceMaps.len) and
|
||||||
i.line < gSourceMaps[i.fileIndex].lines.len
|
(gSourceMaps[i.fileIndex].lines != nil) and
|
||||||
|
(i.line < gSourceMaps[i.fileIndex].lines.len)): return
|
||||||
|
|
||||||
defFromLine(gSourceMaps[i.fileIndex].lines[i.line].entries, i.col)
|
defFromLine(gSourceMaps[i.fileIndex].lines[i.line].entries, i.col)
|
||||||
|
|
||||||
proc suggestSym*(n: PNode, s: PSym) {.inline.} =
|
proc suggestSym*(n: PNode, s: PSym) {.inline.} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue