diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-08-09 08:18:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-09 08:18:47 +0800 |
commit | d136af012298b58be5abfb5e095cabd158feeb2e (patch) | |
tree | ca11fb31c3d2836a1398b96e4fbab34155aea22a | |
parent | 73e661d01bdde815a5f388b960cd4d0593f7accc (diff) | |
download | Nim-d136af012298b58be5abfb5e095cabd158feeb2e.tar.gz |
modernize lineinfos; it seems that array access hinders strict def analysis like field access (#22420)
modernize lineinfos; array access hinders strict def analysis like field access A bug ? ```nim proc computeNotesVerbosity(): array[0..3, TNoteKinds] = result[3] = {low(TNoteKind)..high(TNoteKind)} - {warnObservableStores, warnResultUsed, warnAnyEnumConv, warnBareExcept} result[2] = result[3] - {hintStackTrace, hintExtendedContext, hintDeclaredLoc, hintProcessingStmt} result[1] = result[2] - {warnProveField, warnProveIndex, warnGcUnsafe, hintPath, hintDependency, hintCodeBegin, hintCodeEnd, hintSource, hintGlobalVar, hintGCStats, hintMsgOrigin, hintPerformance} result[0] = result[1] - {hintSuccessX, hintSuccess, hintConf, hintProcessing, hintPattern, hintExecuting, hintLinking, hintCC} ```
-rw-r--r-- | compiler/lineinfos.nim | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/lineinfos.nim b/compiler/lineinfos.nim index 6ebf3b538..12495aa22 100644 --- a/compiler/lineinfos.nim +++ b/compiler/lineinfos.nim @@ -7,8 +7,8 @@ # distribution, for details about the copyright. # -## This module contains the ``TMsgKind`` enum as well as the -## ``TLineInfo`` object. +## This module contains the `TMsgKind` enum as well as the +## `TLineInfo` object. import ropes, tables, pathutils, hashes @@ -248,6 +248,7 @@ type TNoteKinds* = set[TNoteKind] proc computeNotesVerbosity(): array[0..3, TNoteKinds] = + result = default(array[0..3, TNoteKinds]) result[3] = {low(TNoteKind)..high(TNoteKind)} - {warnObservableStores, warnResultUsed, warnAnyEnumConv, warnBareExcept} result[2] = result[3] - {hintStackTrace, hintExtendedContext, hintDeclaredLoc, hintProcessingStmt} result[1] = result[2] - {warnProveField, warnProveIndex, @@ -341,9 +342,8 @@ type proc initMsgConfig*(): MsgConfig = - result.msgContext = @[] - result.lastError = unknownLineInfo - result.filenameToIndexTbl = initTable[string, FileIndex]() - result.fileInfos = @[] - result.errorOutputs = {eStdOut, eStdErr} + result = MsgConfig(msgContext: @[], lastError: unknownLineInfo, + filenameToIndexTbl: initTable[string, FileIndex](), + fileInfos: @[], errorOutputs: {eStdOut, eStdErr} + ) result.filenameToIndexTbl["???"] = FileIndex(-1) |