예제 #1
0
 /// <summary>
 /// Replaces child nodes.
 /// </summary>
 /// <typeparam name="TNode"></typeparam>
 /// <param name="nodes"></param>
 /// <param name="computeReplacementNode"></param>
 /// <param name="tokens"></param>
 /// <param name="computeReplacementToken"></param>
 /// <param name="trivia"></param>
 /// <param name="computeReplacementTrivia"></param>
 /// <returns></returns>
 protected internal override SyntaxNode ReplaceCore <TNode>(
     IEnumerable <TNode>?nodes = null,
     Func <TNode, TNode, SyntaxNode>?computeReplacementNode = null,
     IEnumerable <SyntaxToken>?tokens = null,
     Func <SyntaxToken, SyntaxToken, SyntaxToken>?computeReplacementToken = null,
     IEnumerable <SyntaxTrivia>?trivia = null,
     Func <SyntaxTrivia, SyntaxTrivia, SyntaxTrivia>?computeReplacementTrivia = null)
 =>
 SyntaxReplacer.Replace(this, nodes, computeReplacementNode, tokens, computeReplacementToken, trivia, computeReplacementTrivia).AsRootOfNewTreeWithOptionsFrom(SyntaxTree);
예제 #2
0
 protected internal override SyntaxNode ReplaceCore <TNode>(
     IEnumerable <TNode> nodes = null,
     Func <TNode, TNode, SyntaxNode> computeReplacementNode = null,
     IEnumerable <SyntaxToken> tokens = null,
     Func <SyntaxToken, SyntaxToken, SyntaxToken> computeReplacementToken = null,
     IEnumerable <SyntaxTrivia> trivia = null,
     Func <SyntaxTrivia, SyntaxTrivia, SyntaxTrivia> computeReplacementTrivia = null)
 {
     return(SyntaxReplacer.Replace(this, nodes, computeReplacementNode, tokens, computeReplacementToken, trivia, computeReplacementTrivia));
 }
예제 #3
0
 /// <summary>
 /// Creates a new token with the specified old trivia replaced with computed new trivia.
 /// </summary>
 /// <param name="trivia">The trivia to be replaced; descendants of the root token.</param>
 /// <param name="computeReplacementTrivia">A function that computes a replacement trivia for
 /// the argument trivia. The first argument is the original trivia. The second argument is
 /// the same trivia rewritten with replaced structure.</param>
 public SyntaxToken ReplaceTrivia(IEnumerable <SyntaxTrivia> trivia, Func <SyntaxTrivia, SyntaxTrivia, SyntaxTriviaList> computeReplacementTrivia)
 {
     return(SyntaxReplacer.Replace(this, trivia: trivia, computeReplacementTrivia: computeReplacementTrivia));
 }
예제 #4
0
 /// <summary>
 /// Creates a new token with the specified old trivia replaced with a new trivia. The old trivia may appear in
 /// the token's leading or trailing trivia.
 /// </summary>
 /// <param name="oldTrivia">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 SyntaxToken ReplaceTrivia(SyntaxTrivia oldTrivia, SyntaxTriviaList newTrivia)
 {
     return(SyntaxReplacer.Replace(this, trivia: new[] { oldTrivia }, computeReplacementTrivia: (o, r) => newTrivia));
 }
예제 #5
0
 /// <summary>
 /// Creates a new token with the specified old trivia replaced with computed new trivia.
 /// </summary>
 /// <param name="token"></param>
 /// <param name="trivia">The trivia to be replaced; descendants of the root token.</param>
 /// <param name="computeReplacementTrivia">A function that computes a replacement trivia for
 /// the argument trivia. The first argument is the original trivia. The second argument is
 /// the same trivia rewritten with replaced structure.</param>
 public static SyntaxToken ReplaceTrivia(this SyntaxToken token, IEnumerable <SyntaxTrivia> trivia, Func <SyntaxTrivia, SyntaxTrivia, SyntaxTrivia> computeReplacementTrivia)
 {
     return(SyntaxReplacer.Replace(token, trivia: trivia, computeReplacementTrivia: computeReplacementTrivia));
 }