summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorParashurama <Rhagdamaziel@ymail.com>2016-06-11 09:49:19 +0200
committerParashurama <Rhagdamaziel@ymail.com>2016-06-11 15:09:10 +0200
commit6c8b06b2a38b41559c5387d98d3bf1429e936236 (patch)
tree112d3561b10ccd1c98fb80522ac2d8931ef129bd /compiler
parent78b5f6416663694742f4449b62fc5463ac2c0747 (diff)
downloadNim-6c8b06b2a38b41559c5387d98d3bf1429e936236.tar.gz
adds --excessiveStackTrace:on|off flag for nim
display absolute file path in error messages.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/commands.nim1
-rw-r--r--compiler/msgs.nim8
-rw-r--r--compiler/options.nim2
3 files changed, 10 insertions, 1 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim
index 3bc0b604a..5601ef662 100644
--- a/compiler/commands.nim
+++ b/compiler/commands.nim
@@ -409,6 +409,7 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
     if processOnOffSwitchOrList({optHints}, arg, pass, info): listHints()
   of "threadanalysis": processOnOffSwitchG({optThreadAnalysis}, arg, pass, info)
   of "stacktrace": processOnOffSwitch({optStackTrace}, arg, pass, info)
+  of "excessivestacktrace": processOnOffSwitchG({optExcessiveStackTrace}, arg, pass, info)
   of "linetrace": processOnOffSwitch({optLineTrace}, arg, pass, info)
   of "debugger":
     case arg.normalize
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 3606bdd12..ce9d8c8b6 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -471,6 +471,8 @@ type
     shortName*: string         # short name of the module
     quotedName*: Rope          # cached quoted short name for codegen
                                # purposes
+    quotedFullName*: Rope      # cached quoted full name for codegen
+                               # purposes
 
     lines*: seq[Rope]          # the source code of the module
                                #   used for better error messages and
@@ -563,6 +565,7 @@ proc newFileInfo(fullPath, projPath: string): TFileInfo =
   let fileName = projPath.extractFilename
   result.shortName = fileName.changeFileExt("")
   result.quotedName = fileName.makeCString
+  result.quotedFullName = fullPath.makeCString
   if optEmbedOrigSrc in gGlobalOptions or true:
     result.lines = @[]
 
@@ -1024,7 +1027,10 @@ proc sourceLine*(i: TLineInfo): Rope =
 
 proc quotedFilename*(i: TLineInfo): Rope =
   internalAssert i.fileIndex >= 0
-  result = fileInfos[i.fileIndex].quotedName
+  if optExcessiveStackTrace in gGlobalOptions:
+    result = fileInfos[i.fileIndex].quotedFullName
+  else:
+    result = fileInfos[i.fileIndex].quotedName
 
 ropes.errorHandler = proc (err: RopesError, msg: string, useWarning: bool) =
   case err
diff --git a/compiler/options.nim b/compiler/options.nim
index 3ef6c6c46..7797a4c82 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -67,6 +67,8 @@ type                          # please make sure we have under 32 options
     optIdeDebug               # idetools: debug mode
     optIdeTerse               # idetools: use terse descriptions
     optNoCppExceptions        # use C exception handling even with CPP
+    optExcessiveStackTrace    # fully qualified module filenames
+
   TGlobalOptions* = set[TGlobalOption]
   TCommands* = enum           # Nim's commands
                               # **keep binary compatible**