diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2018-07-31 14:02:04 -0700 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-07-31 23:02:04 +0200 |
commit | 818d9be31117a90c0707fdbb9e471abca2abac40 (patch) | |
tree | d1d45c0a13d4b6819ae80fb9378479cab29463d6 | |
parent | 931273cc6be25a4d2bc79e8a0eff8781c1f4855e (diff) | |
download | Nim-818d9be31117a90c0707fdbb9e471abca2abac40.tar.gz |
`lineInfoObj` (and `check`, `expect`) now return absolute paths (#8466)
-rw-r--r-- | changelog.md | 3 | ||||
-rw-r--r-- | compiler/vm.nim | 2 | ||||
-rw-r--r-- | lib/core/macros.nim | 1 |
3 files changed, 4 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md index e0027d504..3dfe63f3b 100644 --- a/changelog.md +++ b/changelog.md @@ -25,7 +25,6 @@ - The dot style for import paths (e.g ``import path.to.module`` instead of ``import path/to/module``) has been deprecated. - #### Breaking changes in the standard library - ``re.split`` for empty regular expressions now yields every character in @@ -61,6 +60,8 @@ 1-based coordinates on POSIX for correct behaviour; the Windows behaviour was always correct). +- ``lineInfoObj`` now returns absolute path instead of project path. + It's used by ``lineInfo``, ``check``, ``expect``, ``require``, etc. #### Breaking changes in the compiler diff --git a/compiler/vm.nim b/compiler/vm.nim index d7e1b5da3..f8b1cee73 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -1409,7 +1409,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg = of opcNGetFile: decodeB(rkNode) let n = regs[rb].node - regs[ra].node = newStrNode(nkStrLit, toFilename(c.config, n.info)) + regs[ra].node = newStrNode(nkStrLit, toFullPath(c.config, n.info)) regs[ra].node.info = n.info regs[ra].node.typ = n.typ of opcNGetLine: diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 345c53b08..17178a634 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -425,6 +425,7 @@ proc getColumn(arg: NimNode): int {.magic: "NLineInfo", noSideEffect.} proc getFile(arg: NimNode): string {.magic: "NLineInfo", noSideEffect.} proc lineInfoObj*(n: NimNode): LineInfo {.compileTime.} = + ## returns ``LineInfo`` of ``n``, using absolute path for ``filename`` result.filename = n.getFile result.line = n.getLine result.column = n.getColumn |