示例#1
0
 protected internal override SyntaxNode ReplaceTriviaInListCore(
     SyntaxTrivia originalTrivia,
     IEnumerable <SyntaxTrivia> newTrivia
     )
 {
     return(SyntaxReplacer
            .ReplaceTriviaInList(this, originalTrivia, newTrivia)
            .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree));
 }
示例#2
0
 protected internal override SyntaxNode ReplaceNodeInListCore(
     SyntaxNode originalNode,
     IEnumerable <SyntaxNode> replacementNodes
     )
 {
     return(SyntaxReplacer
            .ReplaceNodeInList(this, originalNode, replacementNodes)
            .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree));
 }
示例#3
0
 protected internal override SyntaxNode ReplaceTokenInListCore(
     SyntaxToken originalToken,
     IEnumerable <SyntaxToken> newTokens
     )
 {
     return(SyntaxReplacer
            .ReplaceTokenInList(this, originalToken, newTokens)
            .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree));
 }
示例#4
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);
示例#5
0
 protected internal override SyntaxNode InsertTokensInListCore(
     SyntaxToken originalToken,
     IEnumerable <SyntaxToken> newTokens,
     bool insertBefore
     )
 {
     return(SyntaxReplacer
            .InsertTokenInList(this, originalToken, newTokens, insertBefore)
            .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree));
 }
示例#6
0
 protected internal override SyntaxNode InsertNodesInListCore(
     SyntaxNode nodeInList,
     IEnumerable <SyntaxNode> nodesToInsert,
     bool insertBefore
     )
 {
     return(SyntaxReplacer
            .InsertNodeInList(this, nodeInList, nodesToInsert, insertBefore)
            .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree));
 }
示例#7
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));
 }
示例#8
0
 protected internal override SyntaxNode InsertTriviaInListCore(SyntaxTrivia originalTrivia, IEnumerable <SyntaxTrivia> newTrivia, bool insertBefore)
 {
     return(SyntaxReplacer.InsertTriviaInList(this, originalTrivia, newTrivia, insertBefore));
 }
示例#9
0
 protected internal override SyntaxNode ReplaceTriviaInListCore(SyntaxTrivia originalTrivia, IEnumerable <SyntaxTrivia> newTrivia)
 {
     return(SyntaxReplacer.ReplaceTriviaInList(this, originalTrivia, newTrivia));
 }
示例#10
0
 protected internal override SyntaxNode InsertTokensInListCore(SyntaxToken originalToken, IEnumerable <SyntaxToken> newTokens, bool insertBefore)
 {
     return(SyntaxReplacer.InsertTokenInList(this, originalToken, newTokens, insertBefore));
 }
示例#11
0
 protected internal override SyntaxNode ReplaceTokenInListCore(SyntaxToken originalToken, IEnumerable <SyntaxToken> newTokens)
 {
     return(SyntaxReplacer.ReplaceTokenInList(this, originalToken, newTokens));
 }
示例#12
0
 protected internal override SyntaxNode InsertNodesInListCore(SyntaxNode nodeInList, IEnumerable <SyntaxNode> nodesToInsert, bool insertBefore)
 {
     return(SyntaxReplacer.InsertNodeInList(this, nodeInList, nodesToInsert, insertBefore));
 }
示例#13
0
 protected internal override SyntaxNode ReplaceNodeInListCore(SyntaxNode originalNode, IEnumerable <SyntaxNode> replacementNodes)
 {
     return(SyntaxReplacer.ReplaceNodeInList(this, originalNode, replacementNodes));
 }
示例#14
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));
 }
示例#15
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));
 }
示例#16
0
 /// <summary>
 /// Inserts a trivia into a list.
 /// </summary>
 /// <param name="originalTrivia"></param>
 /// <param name="newTrivia"></param>
 /// <param name="insertBefore"></param>
 /// <returns></returns>
 protected internal override SyntaxNode InsertTriviaInListCore(SyntaxTrivia originalTrivia, IEnumerable <SyntaxTrivia> newTrivia, bool insertBefore)
 => SyntaxReplacer.InsertTriviaInList(this, originalTrivia, newTrivia, insertBefore).AsRootOfNewTreeWithOptionsFrom(SyntaxTree);
示例#17
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));
 }