MetalamaAPI documentationAdvanced APIMetalama.​Framework.​Engine.​Code­ModelPartial­Compilation­ExtensionsUpdate­Syntax­Trees
Open sandboxFocus

PartialCompilationExtensions.UpdateSyntaxTrees Method

UpdateSyntaxTrees(IPartialCompilation, Func<SyntaxTree, CancellationToken, SyntaxTree>, CancellationToken)

Updates the syntax trees of a given IPartialCompilation by providing a function that maps a Microsoft.CodeAnalysis.SyntaxTree to a transformed Microsoft.CodeAnalysis.SyntaxTree.

Declaration
public static IPartialCompilation UpdateSyntaxTrees(this IPartialCompilation compilation, Func<SyntaxTree, CancellationToken, SyntaxTree> updateTree, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IPartialCompilation compilation
Func<Microsoft.CodeAnalysis.SyntaxTree, CancellationToken, Microsoft.CodeAnalysis.SyntaxTree> updateTree

A function that maps the old Microsoft.CodeAnalysis.SyntaxTree to the new Microsoft.CodeAnalysis.SyntaxTree.

CancellationToken cancellationToken
Returns
Type Description
IPartialCompilation

A new IPartialCompilation.

UpdateSyntaxTrees(IPartialCompilation, Func<SyntaxNode, CancellationToken, SyntaxNode>, CancellationToken)

Updates the syntax trees of a given IPartialCompilation by providing a function that maps a Microsoft.CodeAnalysis.SyntaxTree to a transformed Microsoft.CodeAnalysis.SyntaxTree.

Declaration
public static IPartialCompilation UpdateSyntaxTrees(this IPartialCompilation compilation, Func<SyntaxNode, CancellationToken, SyntaxNode> updateSyntaxRoot, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IPartialCompilation compilation
Func<Microsoft.CodeAnalysis.SyntaxNode, CancellationToken, Microsoft.CodeAnalysis.SyntaxNode> updateSyntaxRoot

A function that maps the old root Microsoft.CodeAnalysis.SyntaxNode to the new Microsoft.CodeAnalysis.SyntaxNode.

CancellationToken cancellationToken
Returns
Type Description
IPartialCompilation

A new IPartialCompilation.

UpdateSyntaxTrees(IPartialCompilation, Func<SyntaxTree, SyntaxTree>, CancellationToken)

Declaration
public static IPartialCompilation UpdateSyntaxTrees(this IPartialCompilation compilation, Func<SyntaxTree, SyntaxTree> updateTree, CancellationToken cancellationToken = null)
Parameters
Type Name Description
IPartialCompilation compilation
Func<Microsoft.CodeAnalysis.SyntaxTree, Microsoft.CodeAnalysis.SyntaxTree> updateTree
CancellationToken cancellationToken
Returns
Type Description
IPartialCompilation