[refactor] compiler/[msgs, reorder, semstmts]: use toMsgFilename where appropriate (#11595)
* compiler/msgs: toMsgFilename now operates on FileIndex * compiler/reorder: use toMsgFilename for compiler messages * compiler/semstmts: respect listFullPaths for recursive deps error
This commit is contained in:
parent
b7f8031e98
commit
993b3909a8
3 changed files with 9 additions and 8 deletions
|
|
@ -195,12 +195,10 @@ template toFullPath*(conf: ConfigRef; info: TLineInfo): string =
|
|||
template toFullPathConsiderDirty*(conf: ConfigRef; info: TLineInfo): string =
|
||||
string toFullPathConsiderDirty(conf, info.fileIndex)
|
||||
|
||||
proc toMsgFilename*(conf: ConfigRef; info: TLineInfo): string =
|
||||
if info.fileIndex.int32 < 0:
|
||||
return "???"
|
||||
proc toMsgFilename*(conf: ConfigRef; info: FileIndex): string =
|
||||
let
|
||||
absPath = conf.m.fileInfos[info.fileIndex.int32].fullPath.string
|
||||
relPath = conf.m.fileInfos[info.fileIndex.int32].projPath.string
|
||||
absPath = toFullPath(conf, info)
|
||||
relPath = toFilename(conf, info)
|
||||
result = if (optListFullPaths in conf.globalOptions) or
|
||||
(relPath.len > absPath.len) or
|
||||
(relPath.count("..") > 2):
|
||||
|
|
@ -208,6 +206,9 @@ proc toMsgFilename*(conf: ConfigRef; info: TLineInfo): string =
|
|||
else:
|
||||
relPath
|
||||
|
||||
template toMsgFilename*(conf: ConfigRef; info: TLineInfo): string =
|
||||
toMsgFilename(conf, info.fileIndex)
|
||||
|
||||
proc toLinenumber*(info: TLineInfo): int {.inline.} =
|
||||
result = int info.line
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue