c2nim compiles again

This commit is contained in:
Araq 2011-12-12 19:11:31 +01:00
commit 4487b614e1
5 changed files with 15 additions and 10 deletions

View file

@ -410,23 +410,23 @@ proc newFileInfo(fullPath, projPath: string): TFileInfo =
proc fileInfoIdx*(filename: string): int32 =
var
canonical: string
canon: string
pseudoPath = false
try:
canonical = canonicalizePath(filename)
canon = canonicalizePath(filename)
except:
canonical = filename
canon = filename
# The compiler uses "filenames" such as `command line` or `stdin`
# This flag indicates that we are working with such a path here
pseudoPath = true
if filenameToIndexTbl.hasKey(canonical):
result = filenameToIndexTbl[canonical]
if filenameToIndexTbl.hasKey(canon):
result = filenameToIndexTbl[canon]
else:
result = fileInfos.len.int32
fileInfos.add(newFileInfo(canonical, if pseudoPath: "" else: canonical.shortenDir))
filenameToIndexTbl[canonical] = result
fileInfos.add(newFileInfo(canon, if pseudoPath: "" else: canon.shortenDir))
filenameToIndexTbl[canon] = result
proc newLineInfo*(fileInfoIdx: int32, line, col: int): TLineInfo =
result.fileIndex = fileInfoIdx
@ -478,6 +478,10 @@ proc ToFilename*(info: TLineInfo): string =
if info.fileIndex < 0: result = "???"
else: result = fileInfos[info.fileIndex].projPath
proc ToFilename*(fileIdx: int32): string =
if fileIdx < 0: result = "???"
else: result = fileInfos[fileIdx].projPath
proc toFullPath*(info: TLineInfo): string =
if info.fileIndex < 0: result = "???"
else: result = fileInfos[info.fileIndex].fullPath