summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--changelog.md2
-rw-r--r--compiler/semmagic.nim3
-rw-r--r--lib/system.nim2
-rw-r--r--tests/assert/tfailedassert.nim2
4 files changed, 7 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md
index 689c6d253..412c55fca 100644
--- a/changelog.md
+++ b/changelog.md
@@ -8,6 +8,8 @@
 
 - ``re.split`` for empty regular expressions now yields every character in
   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.
 
diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim
index 189babdec..9031e4640 100644
--- a/compiler/semmagic.nim
+++ b/compiler/semmagic.nim
@@ -81,8 +81,11 @@ proc semInstantiationInfo(c: PContext, n: PNode): PNode =
   filename.strVal = if useFullPaths != 0: info.toFullPath else: info.toFilename
   var line = newNodeIT(nkIntLit, n.info, getSysType(tyInt))
   line.intVal = toLinenumber(info)
+  var column = newNodeIT(nkIntLit, n.info, getSysType(tyInt))
+  column.intVal = toColumn(info)
   result.add(filename)
   result.add(line)
+  result.add(column)
 
 proc toNode(t: PType, i: TLineInfo): PNode =
   result = newNodeIT(nkType, i, t)
diff --git a/lib/system.nim b/lib/system.nim
index 3b22e9169..5aeddaf39 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -3737,7 +3737,7 @@ proc astToStr*[T](x: T): string {.magic: "AstToStr", noSideEffect.}
   ## for debugging.
 
 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
   ## of a template.
   ##
diff --git a/tests/assert/tfailedassert.nim b/tests/assert/tfailedassert.nim
index f0ca149f8..8b260a3ab 100644
--- a/tests/assert/tfailedassert.nim
+++ b/tests/assert/tfailedassert.nim
@@ -8,7 +8,7 @@ tfailedassert.nim:27 false assertion from foo
 """
 
 type
-  TLineInfo = tuple[filename: string, line: int]
+  TLineInfo = tuple[filename: string, line: int, column: int]
 
   TMyError = object of Exception
     lineinfo: TLineInfo