Table of Contents

Class IrAttributeCollection

Namespace
MuLang.IR
Assembly
MuLang.IR.dll

Represents immutable well-known diagnostic attributes for an IR program.

public sealed class IrAttributeCollection
Inheritance
IrAttributeCollection
Inherited Members

Constructors

IrAttributeCollection(IrProgramAttributes?, IEnumerable<KeyValuePair<string, IrFunctionAttributes>>, IEnumerable<KeyValuePair<IrSlotAttributeTarget, IrSlotAttributes>>, IEnumerable<KeyValuePair<TypeSymbol, IrTypeAttributes>>)

Initializes a new instance of the IrAttributeCollection class.

public IrAttributeCollection(IrProgramAttributes? program, IEnumerable<KeyValuePair<string, IrFunctionAttributes>> functions, IEnumerable<KeyValuePair<IrSlotAttributeTarget, IrSlotAttributes>> slots, IEnumerable<KeyValuePair<TypeSymbol, IrTypeAttributes>> types)

Parameters

program IrProgramAttributes

The program attributes, or null when absent.

functions IEnumerable<KeyValuePair<string, IrFunctionAttributes>>

The function attributes keyed by portable function identifier.

slots IEnumerable<KeyValuePair<IrSlotAttributeTarget, IrSlotAttributes>>

The slot attributes keyed by containing function and slot identifier.

types IEnumerable<KeyValuePair<TypeSymbol, IrTypeAttributes>>

The type attributes keyed by projected type reference.

Exceptions

ArgumentNullException

Thrown when a collection argument is null.

ArgumentException

Thrown when a target is duplicated.

Properties

Empty

Gets the reusable empty attribute collection.

public static IrAttributeCollection Empty { get; }

Property Value

IrAttributeCollection

Functions

Gets function attributes keyed by portable function identifier.

public IReadOnlyDictionary<string, IrFunctionAttributes> Functions { get; }

Property Value

IReadOnlyDictionary<string, IrFunctionAttributes>

Program

Gets the program attributes, or null when absent.

public IrProgramAttributes? Program { get; }

Property Value

IrProgramAttributes

Slots

Gets slot attributes keyed by containing function and slot identifier.

public IReadOnlyDictionary<IrSlotAttributeTarget, IrSlotAttributes> Slots { get; }

Property Value

IReadOnlyDictionary<IrSlotAttributeTarget, IrSlotAttributes>

Types

Gets type attributes keyed by projected type reference.

public IReadOnlyDictionary<TypeSymbol, IrTypeAttributes> Types { get; }

Property Value

IReadOnlyDictionary<TypeSymbol, IrTypeAttributes>

Methods

TryGetFunction(string, out IrFunctionAttributes?)

Gets the attributes for a function.

public bool TryGetFunction(string functionId, out IrFunctionAttributes? attributes)

Parameters

functionId string

The portable function identifier.

attributes IrFunctionAttributes

When this method returns, contains the function attributes, if found.

Returns

bool

true if attributes were found; otherwise, false.

TryGetSlot(string, int, out IrSlotAttributes?)

Gets the attributes for a function-local slot.

public bool TryGetSlot(string functionId, int slotId, out IrSlotAttributes? attributes)

Parameters

functionId string

The portable function identifier.

slotId int

The function-local slot identifier.

attributes IrSlotAttributes

When this method returns, contains the slot attributes, if found.

Returns

bool

true if attributes were found; otherwise, false.

TryGetType(TypeSymbol, out IrTypeAttributes?)

Gets the attributes for a projected type.

public bool TryGetType(TypeSymbol type, out IrTypeAttributes? attributes)

Parameters

type TypeSymbol

The projected type.

attributes IrTypeAttributes

When this method returns, contains the type attributes, if found.

Returns

bool

true if attributes were found; otherwise, false.