Open sandboxFocus

Class AspectWeaverContext

Provides context and services for IAspectWeaver implementations to transform Roslyn compilations.

Inheritance
AspectWeaverContext
Namespace: Metalama.Framework.Engine.AspectWeavers
Assembly: Metalama.Framework.Sdk.dll
Syntax
[CompileTime]
public sealed class AspectWeaverContext
Remarks

This context is passed to TransformAsync(AspectWeaverContext) and provides:

Formatting: Your weaver does not need to format output code. Metalama handles formatting at the end of the pipeline. However, your weaver must annotate generated nodes using methods from FormattingAnnotations.

Properties

Name Description
AspectClass

Gets the IAspectClass metadata for the aspect type being processed.

AspectInstances

Gets the dictionary of aspect instances that must be processed, keyed by their target ISymbol.

CancellationToken
Compilation

Gets or sets the compilation being transformed.

CompilationServices
GeneratedCodeAnnotation

Gets the SyntaxAnnotation that must be applied to all code generated by the weaver.

Project

Gets the current IProject being compiled.

ServiceProvider

Methods

Name Description
GetOptions<T>(ISymbol)
ReportDiagnostic(Diagnostic)
RewriteAspectTargetsAsync(CSharpSyntaxRewriter, CancellationToken)
RewriteSyntaxTreesAsync(CSharpSyntaxRewriter, CancellationToken)
RewriteSyntaxTreesAsync(Func<SyntaxNode, CSharpSyntaxRewriter>, CancellationToken)

Extension Methods

See Also