Class IrAttributeCollection
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
programIrProgramAttributesThe program attributes, or
nullwhen absent.functionsIEnumerable<KeyValuePair<string, IrFunctionAttributes>>The function attributes keyed by portable function identifier.
slotsIEnumerable<KeyValuePair<IrSlotAttributeTarget, IrSlotAttributes>>The slot attributes keyed by containing function and slot identifier.
typesIEnumerable<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
Functions
Gets function attributes keyed by portable function identifier.
public IReadOnlyDictionary<string, IrFunctionAttributes> Functions { get; }
Property Value
Program
Gets the program attributes, or null when absent.
public IrProgramAttributes? Program { get; }
Property Value
Slots
Gets slot attributes keyed by containing function and slot identifier.
public IReadOnlyDictionary<IrSlotAttributeTarget, IrSlotAttributes> Slots { get; }
Property Value
Types
Gets type attributes keyed by projected type reference.
public IReadOnlyDictionary<TypeSymbol, IrTypeAttributes> Types { get; }
Property Value
Methods
TryGetFunction(string, out IrFunctionAttributes?)
Gets the attributes for a function.
public bool TryGetFunction(string functionId, out IrFunctionAttributes? attributes)
Parameters
functionIdstringThe portable function identifier.
attributesIrFunctionAttributesWhen this method returns, contains the function attributes, if found.
Returns
- bool
trueif 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
functionIdstringThe portable function identifier.
slotIdintThe function-local slot identifier.
attributesIrSlotAttributesWhen this method returns, contains the slot attributes, if found.
Returns
- bool
trueif 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
typeTypeSymbolThe projected type.
attributesIrTypeAttributesWhen this method returns, contains the type attributes, if found.
Returns
- bool
trueif attributes were found; otherwise,false.