Represents a set of declarations to which validators, diagnostics, code fix suggestions, and options can be added. This interface exposes LINQ-like methods that can be combined in complex queries.
Namespace: Metalama.Framework.Validation
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IValidatorReceiver<out TDeclaration> : IValidatorReceiver where TDeclaration : class, IDeclaration
Type Parameters
Name | Description |
---|---|
TDeclaration | The type of declarations in the current set. |
Properties
Name | Description |
---|---|
OriginatingDeclaration | Gets the declaration of the originating fabric or aspect instance. |
OriginatingNamespace | Gets the current namespace, i.e. the one of the originating fabric or aspect instance,
or |
Project | Gets the current project. |
Methods
Name | Description |
---|---|
AfterAllAspects() | Gets an interface that allows to validate the final compilation, after all aspects have been applied. |
BeforeAnyAspect() | Gets an interface that allows to validate the initial compilation, after before any aspect has been applied. |
OfType<TOut>() | |
ReportDiagnostic(Func<TDeclaration, IDiagnostic>) | Reports a diagnostic for each declaration selected by the the current object. |
SelectMany<TMember>(Func<TDeclaration, IEnumerable<TMember>>) | Projects each declaration of the current set to an IEnumerable<T> (typically a list of child declarations) and flattens the resulting sequences into one set. |
SelectTypes(bool) | Selects all types enclosed in declarations of the current set. |
SelectTypesDerivedFrom(INamedType, DerivedTypesOptions) | Selects all types, among those enclosed in declarations of the current set, that derive from or implement a given INamedType. |
SelectTypesDerivedFrom(Type, DerivedTypesOptions) | Selects all types, among those enclosed in declarations of the current set, that derive from or implement a given Type. |
Select<TMember>(Func<TDeclaration, TMember>) | Projects each declaration of the current set into a new declaration. |
SuggestCodeFix(Func<TDeclaration, CodeFix>) | Suggests a code fix for each declaration selected by the current object. |
SuppressDiagnostic(Func<TDeclaration, SuppressionDefinition>) | Suppresses a diagnostic for each declaration selected by the current object. |
Tag<TTag>(Func<TDeclaration, TTag>) | Projects the declarations in the current set by adding a tag for each declaration, and returns a IValidatorReceiver<TDeclaration, TTag>. Methods of this interface have overloads that accept this tag. |
ToCollection(ICompilation?) | Evaluates the current query into a collection. This method should only be used for debugging or testing purposes. |
ValidateInboundReferences<TValidator>(Func<TDeclaration, TValidator>) | Registers a reference validator, provided by a delegate that provides an instance of the ReferenceValidator abstract class. The reference validator will be invoked to validate references to any declaration in the current set. Only source code references are validated. References added by aspects are ignored by design. |
ValidateReferences<TValidator>(Func<TDeclaration, TValidator>) | |
Where(Func<TDeclaration, bool>) | Filters the set of declarations based on a predicate. |