protected internal override SyntaxNode ReplaceTriviaInListCore( SyntaxTrivia originalTrivia, IEnumerable <SyntaxTrivia> newTrivia ) { return(SyntaxReplacer .ReplaceTriviaInList(this, originalTrivia, newTrivia) .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree)); }
protected internal override SyntaxNode ReplaceNodeInListCore( SyntaxNode originalNode, IEnumerable <SyntaxNode> replacementNodes ) { return(SyntaxReplacer .ReplaceNodeInList(this, originalNode, replacementNodes) .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree)); }
protected internal override SyntaxNode ReplaceTokenInListCore( SyntaxToken originalToken, IEnumerable <SyntaxToken> newTokens ) { return(SyntaxReplacer .ReplaceTokenInList(this, originalToken, newTokens) .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree)); }
/// <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);
protected internal override SyntaxNode InsertTokensInListCore( SyntaxToken originalToken, IEnumerable <SyntaxToken> newTokens, bool insertBefore ) { return(SyntaxReplacer .InsertTokenInList(this, originalToken, newTokens, insertBefore) .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree)); }
protected internal override SyntaxNode InsertNodesInListCore( SyntaxNode nodeInList, IEnumerable <SyntaxNode> nodesToInsert, bool insertBefore ) { return(SyntaxReplacer .InsertNodeInList(this, nodeInList, nodesToInsert, insertBefore) .AsRootOfNewTreeWithOptionsFrom(this.SyntaxTree)); }
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)); }
protected internal override SyntaxNode InsertTriviaInListCore(SyntaxTrivia originalTrivia, IEnumerable <SyntaxTrivia> newTrivia, bool insertBefore) { return(SyntaxReplacer.InsertTriviaInList(this, originalTrivia, newTrivia, insertBefore)); }
protected internal override SyntaxNode ReplaceTriviaInListCore(SyntaxTrivia originalTrivia, IEnumerable <SyntaxTrivia> newTrivia) { return(SyntaxReplacer.ReplaceTriviaInList(this, originalTrivia, newTrivia)); }
protected internal override SyntaxNode InsertTokensInListCore(SyntaxToken originalToken, IEnumerable <SyntaxToken> newTokens, bool insertBefore) { return(SyntaxReplacer.InsertTokenInList(this, originalToken, newTokens, insertBefore)); }
protected internal override SyntaxNode ReplaceTokenInListCore(SyntaxToken originalToken, IEnumerable <SyntaxToken> newTokens) { return(SyntaxReplacer.ReplaceTokenInList(this, originalToken, newTokens)); }
protected internal override SyntaxNode InsertNodesInListCore(SyntaxNode nodeInList, IEnumerable <SyntaxNode> nodesToInsert, bool insertBefore) { return(SyntaxReplacer.InsertNodeInList(this, nodeInList, nodesToInsert, insertBefore)); }
protected internal override SyntaxNode ReplaceNodeInListCore(SyntaxNode originalNode, IEnumerable <SyntaxNode> replacementNodes) { return(SyntaxReplacer.ReplaceNodeInList(this, originalNode, replacementNodes)); }
/// <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)); }
/// <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)); }
/// <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);
/// <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)); }