better file handling for .line directives

This commit is contained in:
Araq 2018-09-14 15:55:29 +02:00
commit 313282d805

View file

@ -585,7 +585,9 @@ proc pragmaLine(c: PContext, n: PNode) =
else: else:
# XXX check if paths are properly resolved this way: # XXX check if paths are properly resolved this way:
let dir = toFullPath(c.config, n.info).splitFile.dir let dir = toFullPath(c.config, n.info).splitFile.dir
n.info.fileIndex = fileInfoIdx(c.config, AbsoluteDir(dir) / RelativeFile(x.strVal)) let rel = if isAbsolute(x.strVal): relativeTo(AbsoluteFile(x.strVal), c.config.projectPath)
else: RelativeFile(x.strVal)
n.info.fileIndex = fileInfoIdx(c.config, AbsoluteDir(dir) / rel)
n.info.line = uint16(y.intVal) n.info.line = uint16(y.intVal)
else: else:
localError(c.config, n.info, "tuple expected") localError(c.config, n.info, "tuple expected")