This module provides default implementation of message reporting hook. Default compiler message formatting is done here.
Implementation is split into several layers
- reportHook - does the necessary message filtering
- reportFull - convert given report to string. Main Report overload dispatches into per-cateogory ones. Full report adds required prefix and suffix (location information, severity, message kind for hints)
- reportBody - generate main report body. Most of the error formatting is done in this proc.
Imports
-
../ast/lineinfos, ../ast/astalgo, ../ast/astmsgs, ../ast/renderer, ../ast/types, ../ast/typesrenderer, ../ast/ast, ../ast/reports, ../ast/reports_cmd, ../ast/reports_lexer, ../ast/reports_parser, ../ast/reports_sem, ../ast/reports_vm, ../ast/reports_backend, ../ast/reports_debug, ../ast/reports_internal, ../ast/reports_external, ../utils/nversion, ../utils/astrepr, ../utils/idioms, msgs, ../sem/nilcheck_enums, ../vm/vm_enums, options, ../ast/reports_base_sem, optionsprocessor
Procs
proc addPragmaAndCallConvMismatch(message: var string; formal, actual: PType; conf: ConfigRef) {....raises: [ValueError], tags: [].}
- Add pragma and calling convention mismatch for the formal (aka expected) and actual (aka provided) types. Source Edit
proc formatTrace(conf: ConfigRef; trace: seq[StackTraceEntry]): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Format stack trace entries for reporting Source Edit
proc getSymRepr(conf: ConfigRef; s: PSym; getDeclarationPath = true): string {. ...raises: [Exception, KeyError, ValueError], tags: [RootEffect, ReadDirEffect].}
- Source Edit
proc legacyReportBridge(conf: ConfigRef; diag: PAstDiag): Report {. ...raises: [ValueError, ERecoverableError], tags: [].}
- Converts AST Diagnostics to legacy reports; meant to be assigned to a ConfigRef as a procedural value and act as a callback. Source Edit
proc presentSpellingCandidates(conf: ConfigRef; candidates: seq[SemSpellCandidate]): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Format potential spelling candidates Source Edit
proc renderAsType(vals: IntSet; t: PType): string {....raises: [ValueError], tags: [].}
- Render integer values as type. For integer no representation conversion is done, for char convert to characters, for enums use enum symbols. Source Edit
proc reportBody(conf: ConfigRef; r: BackendReport): string {. ...raises: [ValueError], tags: [].}
- Source Edit
proc reportBody(conf: ConfigRef; r: CmdReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportBody(conf: ConfigRef; r: DebugReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect, ReadIOEffect].}
- Source Edit
proc reportBody(conf: ConfigRef; r: ExternalReport): string {....raises: [], tags: [].}
- Source Edit
proc reportBody(conf: ConfigRef; r: InternalReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportBody(conf: ConfigRef; r: LexerReport): string {....raises: [], tags: [].}
- Source Edit
proc reportBody(conf: ConfigRef; r: ParserReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportBody(conf: ConfigRef; r: Report): string {. ...raises: [ValueError, KeyError, Exception, ERecoverableError], tags: [ReadDirEffect, RootEffect, ReadIOEffect].}
- Generate main body of the report. Dispatches into implementations for specific report categories. Source Edit
proc reportBody(conf: ConfigRef; r: SemReport): string {. ...raises: [ValueError, KeyError, Exception, ERecoverableError], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportBody(conf: ConfigRef; r: VMReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportFull(conf: ConfigRef; r: BackendReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportFull(conf: ConfigRef; r: CmdReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportFull(conf: ConfigRef; r: DebugReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect, ReadIOEffect].}
- Source Edit
proc reportFull(conf: ConfigRef; r: ExternalReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportFull(conf: ConfigRef; r: InternalReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportFull(conf: ConfigRef; r: LexerReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportFull(conf: ConfigRef; r: ParserReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportFull(conf: ConfigRef; r: Report): string {. ...raises: [ValueError, KeyError, Exception, ERecoverableError], tags: [ReadDirEffect, RootEffect, ReadIOEffect].}
- Generate full version of the report (location, severity, body, optional suffix) Source Edit
proc reportFull(conf: ConfigRef; r: SemReport): string {. ...raises: [ValueError, KeyError, Exception, ERecoverableError], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportFull(conf: ConfigRef; r: VMReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportHook(conf: ConfigRef; r: Report): TErrorHandling {. ...raises: [Exception, ValueError, KeyError, ERecoverableError], tags: [RootEffect, ReadDirEffect, ReadIOEffect].}
- Default implementation of the report hook. Dispatches into reportBody for report, which then calls respective (for each report category) reportBody overloads defined above Source Edit
proc reportShort(conf: ConfigRef; r: BackendReport): string {. ...raises: [ValueError], tags: [].}
- Source Edit
proc reportShort(conf: ConfigRef; r: CmdReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportShort(conf: ConfigRef; r: DebugReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect, ReadIOEffect].}
- Source Edit
proc reportShort(conf: ConfigRef; r: ExternalReport): string {.inline, ...raises: [], tags: [].}
- Source Edit
proc reportShort(conf: ConfigRef; r: InternalReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportShort(conf: ConfigRef; r: LexerReport): string {....raises: [], tags: [].}
- Source Edit
proc reportShort(conf: ConfigRef; r: ParserReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportShort(conf: ConfigRef; r: Report): string {. ...raises: [ValueError, KeyError, Exception, ERecoverableError], tags: [ReadDirEffect, RootEffect, ReadIOEffect].}
- Generate short report version of the report Source Edit
proc reportShort(conf: ConfigRef; r: SemReport): string {. ...raises: [ValueError, KeyError, Exception, ERecoverableError], tags: [ReadDirEffect, RootEffect].}
- Source Edit
proc reportShort(conf: ConfigRef; r: VMReport): string {. ...raises: [ValueError, KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
- Source Edit