Skip to main content

ErrorCollector

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.

export interface ErrorCollector {
  errors: CompilerError[]
  syntax(
    site: Site,
    msg: string
  ): void
  throw(): void
}

Properties

errors

The list of compiler errors collected

errorCollector.errors satisfies CompilerError[]

syntax

Adds a syntax error

errorCollector.syntax satisfies (
  site: Site,
  msg: string
) => void

throw

Throws an error if it contains some errors

errorCollector.throw satisfies () => void