Ejemplo n.º 1
0
        /// <summary>
        /// Determines if two trees are the same, disregarding trivia differences.
        /// </summary>
        /// <param name="oldTree">The original tree.</param>
        /// <param name="newTree">The new tree.</param>
        /// <param name="topLevel">
        /// If true then the trees are equivalent if the contained nodes and tokens declaring
        /// metadata visible symbolic information are equivalent, ignoring any differences of nodes inside method bodies
        /// or initializer expressions, otherwise all nodes and tokens must be equivalent.
        /// </param>
        public virtual bool AreEquivalent(SyntaxTree oldTree, SyntaxTree newTree, bool topLevel)
        {
            if (oldTree == null && newTree == null)
            {
                return(true);
            }

            if (oldTree == null || newTree == null)
            {
                return(false);
            }

            return(SyntaxEquivalence.AreEquivalent(oldTree, newTree, ignoreChildNode: null, topLevel: topLevel));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Determines if two lists of syntax nodes are the same, disregarding trivia differences.
 /// </summary>
 /// <param name="oldList">The old list.</param>
 /// <param name="newList">The new list.</param>
 /// <param name="ignoreChildNode">
 /// If specified called for every child syntax node (not token) that is visited during the comparison.
 /// If it returns true the child is recursively visited, otherwise the child and its subtree is disregarded.
 /// </param>
 public virtual bool AreEquivalent <TNode>(SeparatedSyntaxList <TNode> oldList, SeparatedSyntaxList <TNode> newList, Func <int, bool> ignoreChildNode = null)
     where TNode : SyntaxNode
 {
     return(SyntaxEquivalence.AreEquivalent(oldList.Node, newList.Node, ignoreChildNode, topLevel: false));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Determines if two lists of syntax nodes are the same, disregarding trivia differences.
 /// </summary>
 /// <param name="oldList">The old list.</param>
 /// <param name="newList">The new list.</param>
 /// <param name="topLevel">
 /// If true then the nodes are equivalent if the contained nodes and tokens declaring
 /// metadata visible symbolic information are equivalent, ignoring any differences of nodes inside method bodies
 /// or initializer expressions, otherwise all nodes and tokens must be equivalent.
 /// </param>
 public virtual bool AreEquivalent <TNode>(SeparatedSyntaxList <TNode> oldList, SeparatedSyntaxList <TNode> newList, bool topLevel)
     where TNode : SyntaxNode
 {
     return(SyntaxEquivalence.AreEquivalent(oldList.Node, newList.Node, null, topLevel));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Determines if two lists of tokens are the same, disregarding trivia differences.
 /// </summary>
 /// <param name="oldList">The old token list.</param>
 /// <param name="newList">The new token list.</param>
 public virtual bool AreEquivalent(SyntaxTokenList oldList, SyntaxTokenList newList)
 {
     return(SyntaxEquivalence.AreEquivalent(oldList, newList));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Determines if two syntax tokens are the same, disregarding trivia differences.
 /// </summary>
 /// <param name="oldToken">The old token.</param>
 /// <param name="newToken">The new token.</param>
 public virtual bool AreEquivalent(SyntaxToken oldToken, SyntaxToken newToken)
 {
     return(SyntaxEquivalence.AreEquivalent(oldToken, newToken));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Determines if two syntax nodes are the same, disregarding trivia differences.
 /// </summary>
 /// <param name="oldNode">The old node.</param>
 /// <param name="newNode">The new node.</param>
 /// <param name="ignoreChildNode">
 /// If specified called for every child syntax node (not token) that is visited during the comparison.
 /// If it returns true the child is recursively visited, otherwise the child and its subtree is disregarded.
 /// </param>
 public virtual bool AreEquivalent(SyntaxNode oldNode, SyntaxNode newNode, Func <int, bool> ignoreChildNode = null)
 {
     return(SyntaxEquivalence.AreEquivalent(oldNode, newNode, ignoreChildNode: ignoreChildNode, topLevel: false));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Determines if two syntax nodes are the same, disregarding trivia differences.
 /// </summary>
 /// <param name="oldNode">The old node.</param>
 /// <param name="newNode">The new node.</param>
 /// <param name="topLevel">
 /// If true then the nodes are equivalent if the contained nodes and tokens declaring
 /// metadata visible symbolic information are equivalent, ignoring any differences of nodes inside method bodies
 /// or initializer expressions, otherwise all nodes and tokens must be equivalent.
 /// </param>
 public virtual bool AreEquivalent(SyntaxNode oldNode, SyntaxNode newNode, bool topLevel)
 {
     return(SyntaxEquivalence.AreEquivalent(oldNode, newNode, ignoreChildNode: null, topLevel: topLevel));
 }