Exemple #1
0
            public override SeparatedSyntaxList <TNode> VisitList <TNode>(SeparatedSyntaxList <TNode> list)
            {
                if (_originalNode is TNode node)
                {
                    var index = list.IndexOf(node);
                    if (index >= 0 && index < list.Count)
                    {
                        switch (editKind)
                        {
                        case ListEditKind.Replace:
                            return(list.ReplaceRange(node, _newNodes.Cast <TNode>()));

                        case ListEditKind.InsertAfter:
                            return(list.InsertRange(index + 1, _newNodes.Cast <TNode>()));

                        case ListEditKind.InsertBefore:
                            return(list.InsertRange(index, _newNodes.Cast <TNode>()));
                        }
                    }
                }

                return(base.VisitList(list));
            }
 public override SeparatedSyntaxListWrapper <TNode> ReplaceRange(TNode nodeInList, IEnumerable <TNode> newNodes)
 => new AutoWrapSeparatedSyntaxList <TSyntax>(syntaxList.ReplaceRange((TSyntax)SyntaxWrapper.Unwrap(nodeInList), newNodes.Select(node => (TSyntax)SyntaxWrapper.Unwrap(node))));