Skip to main content

ErrorCollector

export interface ErrorCollector {
  errors: CompilerError[]
  reference(
    site: Site,
    msg: string
  ): void
  syntax(
    site: Site,
    msg: string
  ): void
  throw(): void
  type(
    site: Site,
    msg: string
  ): void
}
An ErrorCollector accumulates CompilerErrors so that at the end of the compilation process all errors are logged at once, and all errors can be displayed in the IDE.

Use makeErrorCollector to create a new ErrorCollector.

Properties

errors

errors: CompilerError[]
The list of compiler errors collected

reference

reference(
  site: Site,
  msg: string
): void
Adds a reference error

syntax

syntax(
  site: Site,
  msg: string
): void
Adds a syntax error

throw

throw(): void
Throws an error if it contains some errors

type

type(
  site: Site,
  msg: string
): void
Adds a type error