compiler/front/msgs

    Dark Mode
Search:
  Source   Edit

Consts

ColOffset = 1
  Source   Edit
gCmdLineInfo = (line: 1'u16, col: 1'i16, fileIndex: -3'i32)
  Source   Edit

Procs

proc `$`(conf: ConfigRef; info: TLineInfo): string {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc `$`(info: TLineInfo): string {.error.}
  Source   Edit
func astDiagToLegacyReportKind(diag: AstDiagKind; vmGenDiag: Option[
    AstDiagVmGenKind] = none(AstDiagVmGenKind); vmEvent: Option[AstDiagVmKind] = none(
    AstDiagVmKind)): ReportKind {.inline, ...raises: [], tags: [].}
with the introduction of adSemDefNameSym style diagnostics, this function is no longer all that sensible. AstDiagKind will move towards very broad categories and they'll no longer map to "reports".   Source   Edit
func astDiagToLegacyReportKind(diag: PAstDiag): ReportKind {.inline, ...raises: [],
    tags: [].}
  Source   Edit
func astDiagVmGenToLegacyReportKind(diag: AstDiagVmGenKind): ReportKind {.
    inline, ...raises: [], tags: [].}
  Source   Edit
func astDiagVmToLegacyReportKind(evt: AstDiagVmKind): ReportKind {.inline,
    ...raises: [], tags: [].}
  Source   Edit
proc doInternalAssert(conf: ConfigRef; instLoc: InstantiationInfo; msg: string;
                      info = unknownLineInfo) {.noreturn, inline,
    ...raises: [Exception, ERecoverableError], tags: [RootEffect].}
this proc firewalls other code from legacy reports, used in conjunction with the internalAssert templates   Source   Edit
proc doInternalUnreachable(conf: ConfigRef; info: TLineInfo; msg: string;
                           instLoc: InstantiationInfo) {.noreturn, inline,
    ...raises: [Exception, ERecoverableError], tags: [RootEffect].}
this proc firewalls other code from legacy reports, used in conjunction with the internalError templates   Source   Edit
proc flushDot(conf: ConfigRef) {....raises: [IOError], tags: [WriteIOEffect].}
safe to call multiple times   Source   Edit
proc formatPath(conf: ConfigRef; path: string): string {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
Format absolute file path for error message reporting. If path is not registered in the filenameToIndexTbl and is not a path to the compiler source, return it unchanged. If configuration is nil also return path unchanged.   Source   Edit
proc getContext(conf: ConfigRef; lastinfo: TLineInfo): seq[ReportContext] {.
    ...raises: [], tags: [].}
Get list of context context entries from the current message context information. Context messages can later be used in the SemReport.context field   Source   Edit
proc getHash(conf: ConfigRef; fileIdx: FileIndex): string {....raises: [], tags: [].}
  Source   Edit
proc getInfoContext(conf: ConfigRef; index: int): TLineInfo {....raises: [],
    tags: [].}
  Source   Edit
proc getInfoContextLen(conf: ConfigRef): int {....raises: [], tags: [].}
  Source   Edit
proc getSurroundingSrc(conf: ConfigRef; info: TLineInfo): string {....raises: [],
    tags: [ReadIOEffect].}
  Source   Edit
proc handleLexerDiag(conf: ConfigRef; diag: LexerDiag;
                     reportFrom: InstantiationInfo;
                     eh: TErrorHandling = doNothing) {.inline,
    ...raises: [ValueError, Exception, ERecoverableError], tags: [RootEffect].}
  Source   Edit
proc handleParserDiag(conf: ConfigRef; diag: ParseDiag;
                      reportFrom: InstantiationInfo;
                      eh: TErrorHandling = doNothing) {.inline,
    ...raises: [Exception, ERecoverableError], tags: [RootEffect].}
  Source   Edit
proc handleReport(conf: ConfigRef; diag: PAstDiag;
                  reportFrom: InstantiationInfo; eh: TErrorHandling = doNothing) {.
    inline, ...raises: [Exception, ERecoverableError], tags: [RootEffect].}
  Source   Edit
proc handleReport(conf: ConfigRef; r: Report; reportFrom: InstantiationInfo;
                  eh: TErrorHandling = doNothing) {.noinline,
    ...raises: [Exception, ERecoverableError], tags: [RootEffect].}
Takes the report r and handles it. If the report is "enabled" according to the active configuration, it is passed to the active report hook and, if the report corresponds to an error, error handling is performed. eh is currently only a suggestion, and it is sometimes ignored depending on the currently active configuration.   Source   Edit
proc joinAnyOf[T](values: seq[T]; quote: bool = false): string
  Source   Edit
func lexDiagToLegacyReportKind(diag: LexerDiagKind): ReportKind {.inline,
    ...raises: [], tags: [].}
  Source   Edit
func lexerDiagToLegacyReport(diag: LexerDiag): Report {.inline,
    ...raises: [ValueError], tags: [].}
  Source   Edit
proc listHints(conf: ConfigRef) {....raises: [Exception, ERecoverableError],
                                  tags: [RootEffect].}
  Source   Edit
proc listWarnings(conf: ConfigRef) {....raises: [Exception, ERecoverableError],
                                     tags: [RootEffect].}
  Source   Edit
proc msgQuit(x: int8) {....raises: [], tags: [].}
  Source   Edit
proc msgQuit(x: string) {....raises: [], tags: [].}
  Source   Edit
proc msgWrite(conf: ConfigRef; s: string; flags: MsgFlags = {}) {.
    ...raises: [IOError], tags: [WriteIOEffect].}

Writes given message string to stderr by default. If --stdout option is given, writes to stdout instead. If message hook is present, then it is used to output message rather than stderr/stdout. This behavior can be altered by given optional flags.

This is used for 'nim dump' etc. where we don't have nimsuggest support.

This procedure is used as a default implementation of the ConfigRef.writeHook.

  Source   Edit
proc numLines(conf: ConfigRef; fileIdx: FileIndex): int {....raises: [],
    tags: [ReadIOEffect].}
xxx there's an off by 1 error that should be fixed; if a file ends with "foo" or "foon" it will return same number of lines (ie, a trailing empty line is discounted)   Source   Edit
proc popInfoContext(conf: ConfigRef) {....raises: [], tags: [].}
Remove one entry from the message context information stack   Source   Edit
proc pushInfoContext(conf: ConfigRef; info: TLineInfo; detail: PSym = nil) {.
    ...raises: [], tags: [].}
Add entry to the message context information stack.   Source   Edit
proc quotedFilename(conf: ConfigRef; i: TLineInfo): Rope {....raises: [], tags: [].}
  Source   Edit
proc report(conf: ConfigRef; node: PNode): TErrorHandling {....raises: [Exception],
    tags: [RootEffect].}
Write out report from the nkError node   Source   Edit
proc semReportCountMismatch(kind: ReportKind;
                            expected, got: distinct SomeInteger;
                            node: PNode = nil): SemReport
  Source   Edit
proc setDirtyFile(conf: ConfigRef; fileIdx: FileIndex; filename: AbsoluteFile) {.
    ...raises: [], tags: [].}
  Source   Edit
proc setHash(conf: ConfigRef; fileIdx: FileIndex; hash: string) {....raises: [],
    tags: [].}
  Source   Edit
proc setInfoContextLen(conf: ConfigRef; L: int) {....raises: [], tags: [].}
  Source   Edit
proc sourceLine(conf: ConfigRef; i: TLineInfo): string {....raises: [],
    tags: [ReadIOEffect].}
1-based index (matches editor line numbers); 1st line is for i.line = 1 last valid line is numLines inclusive   Source   Edit
proc suggestQuit() {....raises: [ESuggestDone], tags: [].}
  Source   Edit
proc temporaryStringError(conf: ConfigRef; info: TLineInfo; text: string) {.
    ...raises: [], tags: [].}
  Source   Edit
proc toColumn(info: TLineInfo): int {.inline, ...raises: [], tags: [].}
  Source   Edit
proc toFileLineCol(conf: ConfigRef; info: TLineInfo): string {.inline,
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
Construct file(line, col) string from report location information   Source   Edit
proc toFileLineCol(info: InstantiationInfo): string {.inline, ...raises: [],
    tags: [].}
  Source   Edit
proc toFilenameOption(conf: ConfigRef; fileIdx: FileIndex; opt: FilenameOption): string {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc toFullPath(conf: ConfigRef; fileIdx: FileIndex): string {....raises: [],
    tags: [].}
  Source   Edit
proc toFullPathConsiderDirty(conf: ConfigRef; fileIdx: FileIndex): AbsoluteFile {.
    ...raises: [], tags: [].}
  Source   Edit
proc toLinenumber(info: TLineInfo): int {.inline, ...raises: [], tags: [].}
  Source   Edit
proc toMsgFilename(conf: ConfigRef; fileIdx: FileIndex): string {.
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
  Source   Edit
proc toProjPath(conf: ConfigRef; fileIdx: FileIndex): string {....raises: [],
    tags: [].}
  Source   Edit
proc toReportLineInfo(conf: ConfigRef; info: TLineInfo): ReportLineInfo {.
    ...raises: [], tags: [].}
  Source   Edit
proc toReportPoint(conf: ConfigRef; info: TLineInfo): ReportLineInfo {.inline,
    ...raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
Construct report location instance based on the information from info   Source   Edit
proc uniqueModuleName(conf: ConfigRef; fid: FileIndex): string {.
    ...raises: [Exception], tags: [RootEffect].}
The unique module name is guaranteed to only contain {'A'..'Z', 'a'..'z', '0'..'9', '_'} so that it is useful as a C identifier snippet.   Source   Edit

Templates

template createSemIllformedAstMsg(node: PNode; expected: set[TNodeKind]): string
  Source   Edit
template fatalReport(conf: ConfigRef; info: TLineInfo; report: ReportTypes)
  Source   Edit
template globalAssert(conf: ConfigRef; cond: untyped;
                      info: TLineInfo = unknownLineInfo; arg = "")
avoids boilerplate   Source   Edit
template globalReport(conf: ConfigRef; info: TLineInfo; report: ReportTypes)
local means compilation keeps going until errorMax is reached (via doNothing), global means it stops.   Source   Edit
template globalReport(conf: ConfigRef; report: ReportTypes)
  Source   Edit
template internalAssert(conf: ConfigRef; condition: bool; failMsg = "")
Causes an internal error if the provided condition evaluates to false. Always ends the currently executing routine.   Source   Edit
template internalAssert(conf: ConfigRef; condition: bool; info: TLineInfo;
                        failMsg: string = "")
Causes an internal error if the provided condition evaluates to false. Always ends the currently executing routine.   Source   Edit
template internalError(conf: ConfigRef; fail: string): untyped
Causes an internal error. Always ends the currently executing routine.   Source   Edit
template internalError(conf: ConfigRef; info: TLineInfo; fail: string): untyped
Causes an internal error. Always ends the currently executing routine.   Source   Edit
template localReport(conf: ConfigRef; info: TLineInfo; report: ReportTypes)
  Source   Edit
template localReport(conf: ConfigRef; info: TLineInfo; report: ReportTypes)
  Source   Edit
template localReport(conf: ConfigRef; node: PNode; report: SemReport)
  Source   Edit
template localReport(conf: ConfigRef; report: Report)
  Source   Edit
template localReport(conf: ConfigRef; report: ReportTypes)
  Source   Edit
template semReportIllformedAst(conf: ConfigRef; node: PNode;
                               expected: set[TNodeKind]): untyped
  Source   Edit
template semReportIllformedAst(conf: ConfigRef; node: PNode; explain: string): untyped
  Source   Edit
template toFullPath(conf: ConfigRef; info: TLineInfo): string
  Source   Edit
template toFullPathConsiderDirty(conf: ConfigRef; info: TLineInfo): string
  Source   Edit
template toMsgFilename(conf: ConfigRef; info: TLineInfo): string
  Source   Edit
template toProjPath(conf: ConfigRef; info: TLineInfo): string
  Source   Edit