summary refs log tree commit diff stats
path: root/compiler/lineinfos.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/lineinfos.nim')
-rw-r--r--compiler/lineinfos.nim44
1 files changed, 18 insertions, 26 deletions
diff --git a/compiler/lineinfos.nim b/compiler/lineinfos.nim
index cad1fe6aa..b8678e6ba 100644
--- a/compiler/lineinfos.nim
+++ b/compiler/lineinfos.nim
@@ -45,7 +45,8 @@ type
     hintExecuting, hintLinking, hintDependency,
     hintSource, hintPerformance, hintStackTrace, hintGCStats,
     hintGlobalVar,
-    hintUser, hintUserRaw
+    hintUser, hintUserRaw,
+    hintExtendedContext
 
 const
   MsgKindToStr*: array[TMsgKind, string] = [
@@ -116,7 +117,9 @@ const
     hintGCStats: "$1",
     hintGlobalVar: "global variable declared here",
     hintUser: "$1",
-    hintUserRaw: "$1"]
+    hintUserRaw: "$1",
+    hintExtendedContext: "$1",
+  ]
 
 const
   WarningsToStr* = ["CannotOpenFile", "OctalEscape",
@@ -132,12 +135,14 @@ const
     "GcMem", "Destructor", "LockLevel", "ResultShadowed",
     "Spacing", "User"]
 
-  HintsToStr* = ["Success", "SuccessX", "LineTooLong",
+  HintsToStr* = [
+    "Success", "SuccessX", "LineTooLong",
     "XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",
     "ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf",
     "Path", "CondTrue", "Name", "Pattern", "Exec", "Link", "Dependency",
     "Source", "Performance", "StackTrace", "GCStats", "GlobalVar",
-    "User", "UserRaw"]
+    "User", "UserRaw", "ExtendedContext",
+  ]
 
 const
   fatalMin* = errUnknown
@@ -157,30 +162,17 @@ type
   TNoteKind* = range[warnMin..hintMax] # "notes" are warnings or hints
   TNoteKinds* = set[TNoteKind]
 
-const
-  NotesVerbosity*: array[0..3, TNoteKinds] = [
-    {low(TNoteKind)..high(TNoteKind)} - {warnShadowIdent, warnUninit,
-                                         warnProveField, warnProveIndex,
-                                         warnGcUnsafe,
-                                         hintSuccessX, hintPath, hintConf,
-                                         hintProcessing, hintPattern,
-                                         hintDependency,
-                                         hintExecuting, hintLinking,
-                                         hintCodeBegin, hintCodeEnd,
-                                         hintSource, hintStackTrace,
-                                         hintGlobalVar, hintGCStats},
-    {low(TNoteKind)..high(TNoteKind)} - {warnShadowIdent, warnUninit,
-                                         warnProveField, warnProveIndex,
-                                         warnGcUnsafe,
-                                         hintPath,
-                                         hintDependency,
-                                         hintCodeBegin, hintCodeEnd,
-                                         hintSource, hintStackTrace,
-                                         hintGlobalVar, hintGCStats},
-    {low(TNoteKind)..high(TNoteKind)} - {hintStackTrace, warnUninit},
-    {low(TNoteKind)..high(TNoteKind)}]
+proc computeNotesVerbosity(): array[0..3, TNoteKinds] =
+    result[3] = {low(TNoteKind)..high(TNoteKind)} - {}
+    result[2] = result[3] - {hintStackTrace, warnUninit, hintExtendedContext}
+    result[1] = result[2] - {warnShadowIdent, warnProveField, warnProveIndex,
+      warnGcUnsafe, hintPath, hintDependency, hintCodeBegin, hintCodeEnd,
+      hintSource, hintGlobalVar, hintGCStats}
+    result[0] = result[1] - {hintSuccessX, hintConf, hintProcessing,
+      hintPattern, hintExecuting, hintLinking}
 
 const
+  NotesVerbosity* = computeNotesVerbosity()
   errXMustBeCompileTime* = "'$1' can only be used in compile-time context"
   errArgsNeedRunOption* = "arguments can only be given if the '--run' option is selected"