summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAdam Strzelecki <ono@java.pl>2015-06-06 11:34:27 +0200
committerAdam Strzelecki <ono@java.pl>2015-07-03 14:05:00 +0200
commitd568ac335751d9caa6dd6118a13b1ee856d402e3 (patch)
tree14425af783aabdb38dc8e58cca5b12a0600d52e9
parent00366cb8d461ba1df443c537fa21bebe838d2f79 (diff)
downloadNim-d568ac335751d9caa6dd6118a13b1ee856d402e3.tar.gz
Turn optPrintSurroundingSrc into hintSource
So surrounding source printing can be enabled for lower verbosity levels
explicitly.
-rw-r--r--compiler/msgs.nim13
-rw-r--r--compiler/options.nim3
2 files changed, 9 insertions, 7 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 3a23d4671..175434c83 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -127,6 +127,7 @@ type
     hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath,
     hintConditionAlwaysTrue, hintName, hintPattern,
     hintExecuting, hintLinking, hintDependency,
+    hintSource,
     hintUser
 
 const
@@ -420,6 +421,7 @@ const
     hintExecuting: "$1",
     hintLinking: "",
     hintDependency: "$1",
+    hintSource: "$1",
     hintUser: "$1"]
 
 const
@@ -435,10 +437,11 @@ const
     "ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit",
     "GcMem", "Destructor", "LockLevel", "ResultShadowed", "User"]
 
-  HintsToStr*: array[0..19, string] = ["Success", "SuccessX", "LineTooLong",
+  HintsToStr*: array[0..20, string] = ["Success", "SuccessX", "LineTooLong",
     "XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",
     "ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf",
     "Path", "CondTrue", "Name", "Pattern", "Exec", "Link", "Dependency",
+    "Source",
     "User"]
 
 const
@@ -498,13 +501,15 @@ const
                                          hintProcessing,
                                          hintDependency,
                                          hintExecuting, hintLinking,
-                                         hintCodeBegin, hintCodeEnd},
+                                         hintCodeBegin, hintCodeEnd,
+                                         hintSource},
     {low(TNoteKind)..high(TNoteKind)} - {warnShadowIdent, warnUninit,
                                          warnProveField, warnProveIndex,
                                          warnGcUnsafe,
                                          hintDependency,
                                          hintExecuting,
-                                         hintCodeBegin, hintCodeEnd},
+                                         hintCodeBegin, hintCodeEnd,
+                                         hintSource},
     {low(TNoteKind)..high(TNoteKind)},
     {low(TNoteKind)..high(TNoteKind)}]
 
@@ -912,7 +917,7 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string,
                        KindColor, `%`(KindFormat, kind))
     else:
       styledMsgWriteln(styleBright, x, resetStyle, color, title, resetStyle, s)
-    if optPrintSurroundingSrc and msg in errMin..errMax:
+    if msg in errMin..errMax and hintSource in gNotes:
       info.writeSurroundingSrc
   handleError(msg, eh, s)
 
diff --git a/compiler/options.nim b/compiler/options.nim
index bc70cd657..f312c877c 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -127,9 +127,6 @@ template compilationCachePresent*: expr =
 template optPreserveOrigSource*: expr =
   optEmbedOrigSrc in gGlobalOptions
 
-template optPrintSurroundingSrc*: expr =
-  gVerbosity >= 2
-
 const
   genSubDir* = "nimcache"
   NimExt* = "nim"