Esempio n. 1
0
        protected async Task <Document> RefactorAsync(
            Document document,
            int nodeIndex,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var info = new RewriterInfo <TSyntax>(
                List[nodeIndex],
                List[nodeIndex - 1],
                GetTokenBefore(nodeIndex),
                GetTokenAfter(nodeIndex));

            return(await document.ReplaceNodeAsync(ListSyntax, Rewrite(info), cancellationToken).ConfigureAwait(false));
        }
        protected async Task <Document> RefactorAsync(
            Document document,
            int nodeIndex,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            SyntaxNode root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false);

            var info = new RewriterInfo <TSyntax>(
                List[nodeIndex],
                List[nodeIndex - 1],
                GetTokenBefore(nodeIndex),
                GetTokenAfter(nodeIndex));

            SyntaxNode newRoot = root.ReplaceNode(ListSyntax, Rewrite(info));

            return(document.WithSyntaxRoot(newRoot));
        }
Esempio n. 3
0
 public NodeSyntaxRewriter(RewriterInfo <TSyntax> info)
 {
     Info = info;
 }
 protected override NodeSyntaxRewriter <ArgumentSyntax> GetRewriter(RewriterInfo <ArgumentSyntax> info)
 {
     return(new ArgumentSyntaxRewriter(info));
 }
Esempio n. 5
0
        protected virtual SyntaxNode Rewrite(RewriterInfo <TSyntax> info)
        {
            NodeSyntaxRewriter <TSyntax> rewriter = GetRewriter(info);

            return(rewriter.Visit(ListSyntax));
        }
Esempio n. 6
0
 protected abstract NodeSyntaxRewriter <TSyntax> GetRewriter(RewriterInfo <TSyntax> info);
 public ParameterSyntaxRewriter(RewriterInfo <ParameterSyntax> info)
     : base(info)
 {
 }
 protected override NodeSyntaxRewriter <ParameterSyntax> GetRewriter(RewriterInfo <ParameterSyntax> info)
 {
     return(new ParameterSyntaxRewriter(info));
 }
Esempio n. 9
0
 protected NodeSyntaxRewriter(RewriterInfo <TSyntax> info)
 {
     Info = info;
 }
 public ArgumentSyntaxRewriter(RewriterInfo <ArgumentSyntax> info)
     : base(info)
 {
 }