Пример #1
0
        private void append(TreeViewItem _rootItem, SyntaxNode _node)
        {
            if (__treeView.Items.Count == 0)
            {
                __treeView.Items.Add(_rootItem);
            }

            ChildSyntaxList _children = _node.ChildNodesAndTokens();

            ChildSyntaxList.Enumerator _enumerator = _children.GetEnumerator();
            while (_enumerator.MoveNext())
            {
                SyntaxNodeOrToken _syntaxElement = _enumerator.Current;
                if (_syntaxElement.IsNode)
                {
                    SyntaxNode   _childNode     = _syntaxElement.AsNode();
                    TreeViewItem _childNodeItem = syntaxNodeItem(_childNode);
                    _rootItem.Items.Add(_childNodeItem);
                    append(_childNodeItem, _childNode);
                }
                else
                if (_syntaxElement.IsToken)
                {
                    SyntaxToken _token = _syntaxElement.AsToken();
                    _rootItem.Items.Add(syntaxTokenItem(_token));
                }
            }
        }
Пример #2
0
            public override SyntaxNode VisitBaseList(BaseListSyntax node)
            {
                ChildSyntaxList.Enumerator enumerator = node.ChildNodesAndTokens().GetEnumerator();
                while (enumerator.MoveNext())
                {
                    if (enumerator.Current is { IsNode : true } current)
                    {
                        SyntaxNode currentNode = current.AsNode();
                        if (currentNode is SimpleBaseTypeSyntax nodeToRemove && (nodeToRemove.Type.ToString() == "global::System.Object" || nodeToRemove.Type.ToString() == "System.Object"))
                        {
                            node = node.RemoveNode(nodeToRemove, SyntaxRemoveOptions.KeepNoTrivia);
                            break;
                        }
                    }
                }

                return(node.ChildNodes().Any() ? base.VisitBaseList(node) : null);
            }
Пример #3
0
 public DifferenceInfo(ChildSyntaxList.Enumerator oldChildren, ChildSyntaxList.Enumerator newChildren)
 {
     this.oldChildren = oldChildren;
     this.newChildren = newChildren;
 }
 public DifferenceInfo(ChildSyntaxList.Enumerator oldChildren, ChildSyntaxList.Enumerator newChildren)
 {
     this.oldChildren = oldChildren;
     this.newChildren = newChildren;
 }