mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-14 23:33:28 +00:00
make tcompilerapi green, don't assue projectPath exists
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user