Table of Contents

Struct Diagnostic

Namespace
ZeroC.Slice.Symbols
Assembly
ZeroC.Slice.Symbols.dll

Represents a diagnostic message produced during code generation.

public readonly record struct Diagnostic : IEquatable<Diagnostic>
Implements
Inherited Members

Properties

IsError

Returns whether this diagnostic represents an error.

public bool IsError { get; }

Property Value

bool

Methods

AddNote(string, string?)

Adds the provided message to this diagnostic as a note.

public void AddNote(string message, string? source = null)

Parameters

message string

The message to add as a note.

source string

The source location associated with this note, if any.

Error(string, string?)

Creates a new diagnostic to describe a general error.

public static Diagnostic Error(string message, string? source = null)

Parameters

message string

A message describing the error.

source string

The source location associated with this diagnostic, if any.

Returns

Diagnostic

A new diagnostic.

IncorrectAttributeArgumentCount(string, int, int, string)

Creates a new diagnostic to describe an attribute with an incorrect number of arguments.

public static Diagnostic IncorrectAttributeArgumentCount(string directive, int expected, int actual, string source)

Parameters

directive string

The directive of the attribute that had an incorrect number of arguments.

expected int

The correct number of arguments that should have been supplied to this attribute.

actual int

The actual number of arguments that were supplied to this attribute.

source string

The source location of the attribute with an incorrect number of arguments.

Returns

Diagnostic

A new diagnostic.

InvalidAttribute(string, string)

Creates a new diagnostic to describe an attribute which was invalidly applied to an element.

public static Diagnostic InvalidAttribute(string directive, string source)

Parameters

directive string

The directive of the attribute that was invalid.

source string

The source location of the invalid attribute.

Returns

Diagnostic

A new diagnostic.

MissingRequiredAttribute(string, string)

Creates a new diagnostic to describe a required attribute which was not present.

public static Diagnostic MissingRequiredAttribute(string expectedAttribute, string source)

Parameters

expectedAttribute string

An example of the attribute that was required but missing.

source string

The source location of the Slice construct that was missing the required attribute.

Returns

Diagnostic

A new diagnostic.

UnknownAttribute(string, string)

Creates a new diagnostic to describe an unknown attribute.

public static Diagnostic UnknownAttribute(string directive, string source)

Parameters

directive string

The directive of the attribute that was unknown.

source string

The source location of the unknown attribute.

Returns

Diagnostic

A new diagnostic.