compiler/stage2_l0/src/util/diag.l0

Module util.diag

Overview Symbols grouped by source file: compiler/stage2_l0/src/util/diag.l0

Module: util.diag

Source: compiler/stage2_l0/src/util/diag.l0 Language: Dea/L0

Imports / Includes

  • std.vector

Symbols

Enum DiagnosticSeverity

DiagnosticSeverity

Defines the DiagnosticSeverity enumeration.

Variants:

  • Error
  • Warning
  • Note

Type Alias DiagnosticVector

type DiagnosticVector = VectorBase

Function dgv_create

func dgv_create() -> DiagnosticVector*

Create an empty vector of diagnostics.

Returns: Diagnostic vector with an initial small capacity.

Function dgv_push

func dgv_push(self: DiagnosticVector*, diag: Diagnostic)

Append a diagnostic to the vector.

Parameters:

Function dgv_get

func dgv_get(self: DiagnosticVector*, index: int) -> Diagnostic*

Return a diagnostic from the vector.

Parameters:

  • self: Diagnostic vector to inspect.
  • index: Zero-based diagnostic index.

Returns: Diagnostic at index.

Function dgv_length

func dgv_length(self: DiagnosticVector*) -> int

Return the number of diagnostics stored in the vector.

Parameters:

Returns: Total diagnostic count.

Function dgv_free

func dgv_free(self: DiagnosticVector*)

Free a diagnostic vector and release ARC-owned fields in each entry.

Parameters:

Function diag_create

func diag_create() -> DiagCollector*

Create an empty diagnostic collector.

Returns: New collector with no diagnostics.

Function diag_error

func diag_error(dc: DiagCollector*, phase: string, code: string, message: string, filename: string, line: int, column: int, line_end: int, column_end: int)

Record an error diagnostic.

Parameters:

  • dc: Collector receiving the diagnostic.
  • phase: Compiler phase name.
  • code: Diagnostic code.
  • message: Diagnostic message.
  • filename: Source filename, or empty when unavailable.
  • line: Starting line number.
  • column: Starting column number.
  • line_end: Ending line number.
  • column_end: Ending column number.

Function diag_warn

func diag_warn(dc: DiagCollector*, phase: string, code: string, message: string, filename: string, line: int, column: int, line_end: int, column_end: int)

Record a warning diagnostic.

Parameters:

  • dc: Collector receiving the diagnostic.
  • phase: Compiler phase name.
  • code: Diagnostic code.
  • message: Diagnostic message.
  • filename: Source filename, or empty when unavailable.
  • line: Starting line number.
  • column: Starting column number.
  • line_end: Ending line number.
  • column_end: Ending column number.

Function diag_note

func diag_note(dc: DiagCollector*, phase: string, code: string, message: string, filename: string, line: int, column: int, line_end: int, column_end: int)

Record an informational note diagnostic.

Parameters:

  • dc: Collector receiving the diagnostic.
  • phase: Compiler phase name.
  • code: Diagnostic code.
  • message: Diagnostic message.
  • filename: Source filename, or empty when unavailable.
  • line: Starting line number.
  • column: Starting column number.
  • line_end: Ending line number.
  • column_end: Ending column number.

Function diag_has_errors

func diag_has_errors(dc: DiagCollector*) -> bool

Report whether the collector contains any errors.

Parameters:

Returns: true if at least one error diagnostic has been recorded.

Function diag_count

func diag_count(dc: DiagCollector*) -> int

Return the number of collected diagnostics.

Parameters:

Returns: Total diagnostic count.

Function diag_get

func diag_get(dc: DiagCollector*, index: int) -> Diagnostic*

Return a diagnostic from the collector.

Parameters:

  • dc: Diagnostic collector to inspect.
  • index: Zero-based diagnostic index.

Returns: Diagnostic at index.

Function diag_copy

func diag_copy(dst: DiagCollector*, src: Diagnostic*)

Copy a diagnostic into another collector.

Parameters:

  • dst: Destination collector.
  • src: Diagnostic to copy.

Function diag_free

func diag_free(dc: DiagCollector*)

Free a diagnostic collector and its backing storage.

Parameters:

Struct Diagnostic

Diagnostic represents an error, warning, or note message produced during compilation.

It includes information about the phase of compilation, a code for the specific issue, the severity level, a human-readable message, and the location in the source code.

Diagnostic Field phase

phase: string

Diagnostic Field code

code: string

Diagnostic Field severity

severity: DiagnosticSeverity

Diagnostic Field message

message: string

Diagnostic Field filename

filename: string

Diagnostic Field line

line: int

Diagnostic Field column

column: int

Diagnostic Field line_end

line_end: int

Diagnostic Field column_end

column_end: int

Struct DiagCollector

Represents the DiagCollector structure.

DiagCollector Field items

items: DiagnosticVector*

DiagCollector Field error_count

error_count: int