compiler/ast/reports

    Dark Mode
Search:
  Source   Edit

This module provides type definitions for all structured report entries that compiler can provide.

Note that this module specifically does not import anything else from the compiler - by design it is supposed to be available in every other module (because almost any phase of the compiler can generate reports one way or another). By design report should contain as much information as possible and never be used for any conditional logic in the compiler - it is a final form of the output that can only be printed to the output (either via user-provided report hook implementation, or using one of the built-in ones)

Not using compiler-specific types also allows this report to be easily reused by external tooling - custom error pretty-printers, test runners and so on.

Debug Defines:

compilerDebugCompilerReportStatistics: output stats of counts for various
report kinds

Types

Report = object
  case category*: ReportCategory
  of repLexer:
      lexReport*: LexerReport

  of repParser:
      parserReport*: ParserReport

  of repSem:
      semReport*: SemReport

  of repVM:
      vmReport*: VMReport

  of repCmd:
      cmdReport*: CmdReport

  of repDebug:
      debugReport*: DebugReport

  of repInternal:
      internalReport*: InternalReport

  of repBackend:
      backendReport*: BackendReport

  of repExternal:
      externalReport*: ExternalReport

  
Toplevel wrapper type for the compiler report   Source   Edit

Lets

reportEmpty = Report(category: repInternal,
                     internalReport: InternalReport(kind: repNone))
  Source   Edit

Procs

func `$`(point: ReportLineInfo): string {....raises: [], tags: [].}
  Source   Edit
func actualType(r: SemReport): PType {....raises: [], tags: [].}
  Source   Edit
func category(kind: ReportKind): ReportCategory {....raises: [], tags: [].}
  Source   Edit
func context(report: Report): seq[ReportContext] {....raises: [], tags: [].}
  Source   Edit
func context=(report: var Report; context: seq[ReportContext]) {....raises: [],
    tags: [].}
  Source   Edit
func formalType(r: SemReport): PType {....raises: [], tags: [].}
  Source   Edit
func formalTypeKind(r: SemReport): set[TTypeKind] {....raises: [], tags: [].}
  Source   Edit
func isValid(point: ReportLineInfo): bool {....raises: [], tags: [].}
  Source   Edit
func kind(report: Report): ReportKind {....raises: [], tags: [].}
  Source   Edit
func location(report: Report): Option[TLineInfo] {....raises: [], tags: [].}
  Source   Edit
func reportFrom(report: Report): ReportLineInfo {....raises: [], tags: [].}
  Source   Edit
func reportFrom=(report: var Report; loc: ReportLineInfo) {....raises: [], tags: [].}
  Source   Edit
func reportInst(report: Report): ReportLineInfo {....raises: [], tags: [].}
  Source   Edit
func severity(report: Report; asError: ReportKinds = default(ReportKinds);
              asWarning: ReportKinds = default(ReportKinds)): ReportSeverity {.
    ...raises: [], tags: [].}
Return report severity accounting for 'asError' and 'asWarning' mapping sets.   Source   Edit
func severity(report: ReportTypes; asError: ReportKinds;
              asWarning: ReportKinds = default(ReportKinds)): ReportSeverity
  Source   Edit
func symstr(r: SemReport | VMReport): string
  Source   Edit
func toReportLineInfo(iinfo: InstantiationInfo): ReportLineInfo {....raises: [],
    tags: [].}
  Source   Edit
func wrap(rep: sink BackendReport): Report {....raises: [], tags: [].}
  Source   Edit
func wrap(rep: sink CmdReport): Report {....raises: [], tags: [].}
  Source   Edit
func wrap(rep: sink DebugReport): Report {....raises: [], tags: [].}
  Source   Edit
func wrap(rep: sink ExternalReport): Report {....raises: [], tags: [].}
  Source   Edit
func wrap(rep: sink InternalReport): Report {....raises: [], tags: [].}
  Source   Edit
func wrap(rep: sink LexerReport): Report {....raises: [], tags: [].}
  Source   Edit
func wrap(rep: sink ParserReport): Report {....raises: [], tags: [].}
  Source   Edit
func wrap(rep: sink SemReport): Report {....raises: [], tags: [].}
  Source   Edit
func wrap(rep: sink VMReport): Report {....raises: [], tags: [].}
  Source   Edit
func wrap[R: ReportTypes](iinfo: InstantiationInfo; rep: sink R): Report
  Source   Edit
func wrap[R: ReportTypes](rep: sink R; iinfo: InstantiationInfo): Report
  Source   Edit
func wrap[R: ReportTypes](rep: sink R; iinfo: InstantiationInfo;
                          point: TLineInfo): Report
  Source   Edit
func wrap[R: ReportTypes](rep: sink R; iinfo: ReportLineInfo; point: TLineInfo): Report
  Source   Edit

Templates

template eachCategory(report: Report; field: untyped): untyped
  Source   Edit
template reportHere[R: ReportTypes](report: R): R
  Source   Edit
template wrap(rep: ReportTypes): Report
  Source   Edit

Exports

toInt128, toInt128, ReportLineInfo, rsemAnyEnumConvert, rvmTraceKinds, rbackRstRedefinitionOfLabel, rsemEachIdentIsTuple, rbackRstUnknownSubstitution, ReportSeverity, repBackendKinds, ReportKind, rsemErrorKinds, rcmdRunnableExamplesSuccess, InternalReportKind, repDebugKinds, rsemDuplicateModuleImport, rsemUnreachableCode, rintStackTrace, rsemWarnUnlistedRaises, rsemUnreachableElse, rbackRstUnsupportedLanguage, rintHintKinds, repExternalKinds, repCmdKinds, rintErrKind, SemOrVMReportKind, rsemUnsafeSetLen, rparInconsistentSpacing, ReportKinds, rbackWarningKinds, LexerReportKind, rsemXDeclaredButNotUsed, rintFatalKinds, rsevError, rbackHintKinds, rsemUserHint, rsemInheritFromException, rsevDebug, repLexerKinds, repFatalKinds, rvmErrorKinds, rintWarningKinds, rsemUseBase, rsemWarnGcUnsafe, rsemStrictNotNilResult, repLinterKinds, rsemProveInit, repExternal, rsevHint, rbackCompiling, rsemReportBigOrdsEnergy, rlexLineTooLong, rsemProcessingStmt, rsemGlobalVar, repHintKinds, rextHintKinds, rsemUninit, rsemHintLibDependency, repDebug, rsemUserError, repTraceKinds, rsemStrictNotNilExpr, rsemWarningKinds, repLinkingHints, rcmdWarningKinds, repDataPassKinds, rextPath, rintSuccessX, rparErrorKinds, repInternalKinds, rcmdLinking, rsemProveField, rparWarningKinds, rsemLockLevelMismatch, rsemDeprecatedCompilerOpt, rbackLinking, ExternalReportKind, rbackRstUnsupportedField, rsemUnsafeDefault, rsemXCannotRaiseY, rextConf, rsemHintKinds, rlexDeprecatedOctalPrefix, rbackErrorKinds, rsemExprAlwaysX, rvmHintKinds, rsemReportCountMismatch, rsemCodegenDeclDeprecated, rintQuitCalled, repNilcheckKinds, repPerformanceHints, repCmd, repErrorKinds, rbackRstBrokenLink, rsemUnknownHint, repVMKinds, rintSource, rsemUserWarning, rparHintKinds, rsemConvFromXtoItselfNotNeeded, CmdReportKind, rsevWarning, rsemImplicitCstringConvert, rsemConditionAlwaysTrue, rsemHoleEnumConvert, rsemObservableStores, rsemResultShadowed, rsemUseOfGc, rsemProcessing, rsevTrace, rstWarnings, rsemDeprecatedCompilerOptArg, rlexHintKinds, rcmdHintKinds, repAllKinds, rlexLinterReport, rsemReportOneSym, BackendReportKind, repSem, rcmdCompiling, repHintGroups, SemReportKind, repInternal, rsemClosureWithoutEnv, repLexer, rsemPattern, rsemWarnGcUnsafeListing, rsemDeprecated, repWarningKinds, rsemTypelessParam, rlexSourceCodeFilterOutput, ParserReportKind, repVM, rbackRstRstStyle, rsemConvToBaseNotNeeded, repStrictNotNilWarnings, VMReportKind, repWarningGroups, rintDataPassKinds, repParser, repBackend, rsemSuspiciousEnumConv, rsemLinterReportUse, rparEnablePreviewDotOps, rcmdExecuting, rsemUnknownMagic, rvmWarningKinds, rsemConditionAlwaysFalse, rextErrorKinds, rsemExpandMacro, rsemReportTwoSym, rcmdErrorKinds, DebugReportKind, repSemKinds, rsemExtendedContext, rsemReportListSym, ReportCategory, SemReportErrorKind, rsemUnusedImport, rsevFatal, repParserKinds, rintMsgOrigin, rsemImplicitObjConv, rlexErrorKinds, rintErrorKinds, rsemUnknownWarning, rsemResultUsed, rlexWarningKinds, rsemLinterReport