/// <summary> /// Creates a new tree of nodes with new trivia inserted after the specified trivia. /// </summary> /// <typeparam name="TRoot">The type of the root node.</typeparam> /// <param name="root">The root of the tree of nodes.</param> /// <param name="trivia">The trivia to insert after; a descendant of the root node.</param> /// <param name="newTrivia">A sequence of trivia to insert into the tree immediately after the specified trivia.</param> public static TRoot InsertTriviaAfter <TRoot>(this TRoot root, SyntaxTrivia trivia, IEnumerable <SyntaxTrivia> newTrivia) where TRoot : SyntaxNode { return((TRoot)root.InsertTriviaInListCore(trivia, newTrivia, insertBefore: false)); }
/// <summary> /// Creates a new tree of nodes with the specified trivia replaced with new trivia. /// </summary> /// <typeparam name="TRoot">The type of the root node.</typeparam> /// <param name="root">The root node of the tree of nodes.</param> /// <param name="trivia">The trivia to be replaced.</param> /// <param name="newTrivia">The new trivia to use in the new tree in place of the old trivia.</param> public static TRoot ReplaceTrivia <TRoot>(this TRoot root, SyntaxTrivia trivia, SyntaxTrivia newTrivia) where TRoot : SyntaxNode { return((TRoot)root.ReplaceCore <SyntaxNode>(trivia: new[] { trivia }, computeReplacementTrivia: (o, r) => newTrivia)); }
/// <summary> /// Creates a new tree of nodes with the specified old trivia replaced with new trivia. /// </summary> /// <typeparam name="TRoot">The type of the root node.</typeparam> /// <param name="root">The root of the tree of nodes.</param> /// <param name="oldTrivia">The trivia to be replaced; a descendant of the root node.</param> /// <param name="newTrivia">A sequence of trivia to use in the tree in place of the specified trivia.</param> public static TRoot ReplaceTrivia <TRoot>(this TRoot root, SyntaxTrivia oldTrivia, IEnumerable <SyntaxTrivia> newTrivia) where TRoot : SyntaxNode { return((TRoot)root.ReplaceTriviaInListCore(oldTrivia, newTrivia)); }