Open sandboxFocus

Class PartialCompilationExtensions

Provides extension methods for transforming IPartialCompilation instances.

Inheritance
PartialCompilationExtensions
Namespace: Metalama.Framework.Engine.CodeModel
Assembly: Metalama.Framework.Sdk.dll
Syntax
public static class PartialCompilationExtensions
Remarks

These methods simplify common compilation transformation patterns in IAspectWeaver implementations:

All methods process syntax trees in parallel for performance. When using RewriteSyntaxTreesAsync(IPartialCompilation, CSharpSyntaxRewriter, ProjectServiceProvider, CancellationToken) with a shared rewriter, ensure the rewriter is thread-safe.

Methods

Name Description
AddSyntaxTrees(IPartialCompilation, params SyntaxTree[])
AddSyntaxTrees(IPartialCompilation, IEnumerable<SyntaxTree>)
GetParseOptions(IPartialCompilation)

Gets ParseOptions that should be used when adding new syntax trees to this compilation.

RewriteSyntaxTreesAsync(IPartialCompilation, CSharpSyntaxRewriter, ProjectServiceProvider, CancellationToken)
RewriteSyntaxTreesAsync(IPartialCompilation, Func<SyntaxNode, CSharpSyntaxRewriter>, ProjectServiceProvider, CancellationToken)
UpdateSyntaxTrees(IPartialCompilation, Func<SyntaxNode, CancellationToken, SyntaxNode>, CancellationToken)
UpdateSyntaxTrees(IPartialCompilation, Func<SyntaxTree, SyntaxTree>, CancellationToken)
UpdateSyntaxTrees(IPartialCompilation, Func<SyntaxTree, CancellationToken, SyntaxTree>, CancellationToken)

See Also