Add column number to instantiation info (#7376)
* Add column number to instantiation info Instantiation info left out column number for no good reason. This adds it in as the third element of the tuple. * Fix test that failed and added change to changelog An assertion test failed because it was declaring a type that was expected to be populated by instantiationInfo with the old signature. Also added the changes to the changelog as it is a breaking change.
This commit is contained in:
parent
f543388959
commit
4f1725ad61
4 changed files with 7 additions and 2 deletions
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
- ``re.split`` for empty regular expressions now yields every character in
|
- ``re.split`` for empty regular expressions now yields every character in
|
||||||
the string which is what other programming languages chose to do.
|
the string which is what other programming languages chose to do.
|
||||||
|
- The returned tuple of ``system.instantiationInfo`` now has a third field
|
||||||
|
containing the column of the instantiation.
|
||||||
|
|
||||||
- ``cookies.setCookie` no longer assumes UTC for the expiration date.
|
- ``cookies.setCookie` no longer assumes UTC for the expiration date.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,11 @@ proc semInstantiationInfo(c: PContext, n: PNode): PNode =
|
||||||
filename.strVal = if useFullPaths != 0: info.toFullPath else: info.toFilename
|
filename.strVal = if useFullPaths != 0: info.toFullPath else: info.toFilename
|
||||||
var line = newNodeIT(nkIntLit, n.info, getSysType(tyInt))
|
var line = newNodeIT(nkIntLit, n.info, getSysType(tyInt))
|
||||||
line.intVal = toLinenumber(info)
|
line.intVal = toLinenumber(info)
|
||||||
|
var column = newNodeIT(nkIntLit, n.info, getSysType(tyInt))
|
||||||
|
column.intVal = toColumn(info)
|
||||||
result.add(filename)
|
result.add(filename)
|
||||||
result.add(line)
|
result.add(line)
|
||||||
|
result.add(column)
|
||||||
|
|
||||||
proc toNode(t: PType, i: TLineInfo): PNode =
|
proc toNode(t: PType, i: TLineInfo): PNode =
|
||||||
result = newNodeIT(nkType, i, t)
|
result = newNodeIT(nkType, i, t)
|
||||||
|
|
|
||||||
|
|
@ -3737,7 +3737,7 @@ proc astToStr*[T](x: T): string {.magic: "AstToStr", noSideEffect.}
|
||||||
## for debugging.
|
## for debugging.
|
||||||
|
|
||||||
proc instantiationInfo*(index = -1, fullPaths = false): tuple[
|
proc instantiationInfo*(index = -1, fullPaths = false): tuple[
|
||||||
filename: string, line: int] {. magic: "InstantiationInfo", noSideEffect.}
|
filename: string, line: int, column: int] {. magic: "InstantiationInfo", noSideEffect.}
|
||||||
## provides access to the compiler's instantiation stack line information
|
## provides access to the compiler's instantiation stack line information
|
||||||
## of a template.
|
## of a template.
|
||||||
##
|
##
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ tfailedassert.nim:27 false assertion from foo
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
TLineInfo = tuple[filename: string, line: int]
|
TLineInfo = tuple[filename: string, line: int, column: int]
|
||||||
|
|
||||||
TMyError = object of Exception
|
TMyError = object of Exception
|
||||||
lineinfo: TLineInfo
|
lineinfo: TLineInfo
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue