summary refs log tree commit diff stats
path: root/compiler/msgs.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/msgs.nim')
-rwxr-xr-xcompiler/msgs.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 6cb2fedcd..e1deb6e35 100755
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -476,6 +476,12 @@ proc pushInfoContext*(info: TLineInfo) =
 proc popInfoContext*() = 
   setlen(msgContext, len(msgContext) - 1)
 
+proc getInfoContext*(index: int): TLineInfo =
+  let L = msgContext.len
+  let i = if index < 0: L + index else: index
+  if i >=% L: result = UnknownLineInfo()
+  else: result = msgContext[i]
+
 proc ToFilename*(info: TLineInfo): string =
   if info.fileIndex < 0: result = "???"
   else: result = fileInfos[info.fileIndex].projPath