diff options
author | Araq <rumpf_a@web.de> | 2018-09-14 19:30:02 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-09-14 19:30:02 +0200 |
commit | ed5d2b55053db24e1c14095e08292d7b0b3dcff5 (patch) | |
tree | a832424035ab507065e5c4237e93098a27004946 /compiler/pragmas.nim | |
parent | 0cb72185ae3d8127517e5976d3d48496e8b5006a (diff) | |
download | Nim-ed5d2b55053db24e1c14095e08292d7b0b3dcff5.tar.gz |
make tcompilerapi green, don't assue projectPath exists
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r-- | compiler/pragmas.nim | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 146c35fd9..e6e4eff38 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -583,11 +583,14 @@ proc pragmaLine(c: PContext, n: PNode) = elif y.kind != nkIntLit: localError(c.config, n.info, errIntLiteralExpected) else: - # XXX check if paths are properly resolved this way: - let dir = toFullPath(c.config, n.info).splitFile.dir - 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) + if c.config.projectPath.isEmpty: + n.info.fileIndex = fileInfoIdx(c.config, AbsoluteFile(x.strVal)) + else: + # XXX this is still suspicous: + let dir = toFullPath(c.config, n.info).splitFile.dir + 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) else: localError(c.config, n.info, "tuple expected") |