{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/70733068","id":70733068,"diff_hunk":"@@ -0,0 +1,287 @@\n+﻿// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.\n+\n+using Microsoft.CodeAnalysis.CSharp.Syntax;\n+using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+\n+namespace Microsoft.CodeAnalysis.CSharp\n+{\n+    /// <summary>\n+    /// Represents a non-recursive visitor which descends an entire <see cref=\"CSharpSyntaxNode\"/> graph and\n+    /// may replace or remove visited SyntaxNodes in depth-first order.\n+    /// </summary>\n+    public partial class NonRecursiveRewriter : CSharpSyntaxVisitor<NonRecursiveRewriter.Chunk>\n+    {\n+        public class Chunk\n+        {\n+            private int currentIndex;\n+\n+            internal Chunk(Func<SyntaxNodeOrToken> transform, SyntaxNodeOrToken[] children)\n+            {\n+                this.Transform = transform;\n+                this.ChildNodes = children;\n+                this.currentIndex = children.Length;\n+            }\n+\n+            public Func<SyntaxNodeOrToken> Transform { get; private set; }\n+\n+            public SyntaxNodeOrToken[] ChildNodes { get; private set; }\n+\n+            public bool MoveNextChildNode()\n+            {\n+                return this.currentIndex-- > 0;\n+            }\n+\n+            public SyntaxNodeOrToken GetCurrentChild()\n+            {\n+                return ChildNodes[this.currentIndex];\n+            }\n+        }\n+\n+        private Stack<SyntaxNodeOrToken> rewritenStack = new Stack<SyntaxNodeOrToken>();\n+        protected internal Stack<SyntaxNodeOrToken> RewritenStack\n+        {\n+            get { return this.rewritenStack; }\n+        }\n+\n+        public new SyntaxNode Visit(SyntaxNode node)\n+        {\n+            return this.Visit((SyntaxNodeOrToken)node);\n+        }\n+\n+        public SyntaxNode Visit(SyntaxToken token)\n+        {\n+            return this.Visit((SyntaxNodeOrToken)token);\n+        }\n+\n+        private SyntaxNode Visit(SyntaxNodeOrToken node)\n+        {\n+            if (node == null)","path":"src/Compilers/CSharp/Portable/Syntax/NonRecursiveRewriter.cs","position":60,"original_position":60,"commit_id":"955d54b76bb83e6de67998a9db0430651be35d00","original_commit_id":"955d54b76bb83e6de67998a9db0430651be35d00","user":{"login":"CyrusNajmabadi","id":4564579,"avatar_url":"https://avatars.githubusercontent.com/u/4564579?v=3","gravatar_id":"","url":"https://api.github.com/users/CyrusNajmabadi","html_url":"https://github.com/CyrusNajmabadi","followers_url":"https://api.github.com/users/CyrusNajmabadi/followers","following_url":"https://api.github.com/users/CyrusNajmabadi/following{/other_user}","gists_url":"https://api.github.com/users/CyrusNajmabadi/gists{/gist_id}","starred_url":"https://api.github.com/users/CyrusNajmabadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyrusNajmabadi/subscriptions","organizations_url":"https://api.github.com/users/CyrusNajmabadi/orgs","repos_url":"https://api.github.com/users/CyrusNajmabadi/repos","events_url":"https://api.github.com/users/CyrusNajmabadi/events{/privacy}","received_events_url":"https://api.github.com/users/CyrusNajmabadi/received_events","type":"User","site_admin":false},"body":"can this ever be true?  SyntaxNodeOrToken is a struct.  So it should not be possible for it to be null.","created_at":"2016-07-14T00:39:46Z","updated_at":"2016-07-14T00:39:46Z","html_url":"https://github.com/dotnet/roslyn/pull/12494#discussion_r70733068","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/12494","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/70733068"},"html":{"href":"https://github.com/dotnet/roslyn/pull/12494#discussion_r70733068"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/12494"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/12494","id":77345697,"html_url":"https://github.com/dotnet/roslyn/pull/12494","diff_url":"https://github.com/dotnet/roslyn/pull/12494.diff","patch_url":"https://github.com/dotnet/roslyn/pull/12494.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/12494","number":12494,"state":"open","locked":false,"title":"Add a non recursive rewriter and a full tree non recursive visitor","user":{"login":"MatthieuMEZIL","id":8710406,"avatar_url":"https://avatars.githubusercontent.com/u/8710406?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthieuMEZIL","html_url":"https://github.com/MatthieuMEZIL","followers_url":"https://api.github.com/users/MatthieuMEZIL/followers","following_url":"https://api.github.com/users/MatthieuMEZIL/following{/other_user}","gists_url":"https://api.github.com/users/MatthieuMEZIL/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthieuMEZIL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthieuMEZIL/subscriptions","organizations_url":"https://api.github.com/users/MatthieuMEZIL/orgs","repos_url":"https://api.github.com/users/MatthieuMEZIL/repos","events_url":"https://api.github.com/users/MatthieuMEZIL/events{/privacy}","received_events_url":"https://api.github.com/users/MatthieuMEZIL/received_events","type":"User","site_admin":false},"body":"Adding a non recursive rewriter and a full tree non recursive visitor in order to avoid InsufficientExecutionStackException.","created_at":"2016-07-13T19:18:44Z","updated_at":"2016-07-14T00:39:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/12494/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/12494/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/12494/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/955d54b76bb83e6de67998a9db0430651be35d00","head":{"label":"MatthieuMEZIL:master","ref":"master","sha":"955d54b76bb83e6de67998a9db0430651be35d00","user":{"login":"MatthieuMEZIL","id":8710406,"avatar_url":"https://avatars.githubusercontent.com/u/8710406?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthieuMEZIL","html_url":"https://github.com/MatthieuMEZIL","followers_url":"https://api.github.com/users/MatthieuMEZIL/followers","following_url":"https://api.github.com/users/MatthieuMEZIL/following{/other_user}","gists_url":"https://api.github.com/users/MatthieuMEZIL/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthieuMEZIL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthieuMEZIL/subscriptions","organizations_url":"https://api.github.com/users/MatthieuMEZIL/orgs","repos_url":"https://api.github.com/users/MatthieuMEZIL/repos","events_url":"https://api.github.com/users/MatthieuMEZIL/events{/privacy}","received_events_url":"https://api.github.com/users/MatthieuMEZIL/received_events","type":"User","site_admin":false},"repo":{"id":34499120,"name":"roslyn","full_name":"MatthieuMEZIL/roslyn","owner":{"login":"MatthieuMEZIL","id":8710406,"avatar_url":"https://avatars.githubusercontent.com/u/8710406?v=3","gravatar_id":"","url":"https://api.github.com/users/MatthieuMEZIL","html_url":"https://github.com/MatthieuMEZIL","followers_url":"https://api.github.com/users/MatthieuMEZIL/followers","following_url":"https://api.github.com/users/MatthieuMEZIL/following{/other_user}","gists_url":"https://api.github.com/users/MatthieuMEZIL/gists{/gist_id}","starred_url":"https://api.github.com/users/MatthieuMEZIL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatthieuMEZIL/subscriptions","organizations_url":"https://api.github.com/users/MatthieuMEZIL/orgs","repos_url":"https://api.github.com/users/MatthieuMEZIL/repos","events_url":"https://api.github.com/users/MatthieuMEZIL/events{/privacy}","received_events_url":"https://api.github.com/users/MatthieuMEZIL/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MatthieuMEZIL/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":true,"url":"https://api.github.com/repos/MatthieuMEZIL/roslyn","forks_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/forks","keys_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/teams","hooks_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/hooks","issue_events_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/events","assignees_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/tags","blobs_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/languages","stargazers_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/stargazers","contributors_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/contributors","subscribers_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/subscribers","subscription_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/subscription","commits_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/merges","archive_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/downloads","issues_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/MatthieuMEZIL/roslyn/deployments","created_at":"2015-04-24T05:08:27Z","updated_at":"2016-07-06T18:30:40Z","pushed_at":"2016-07-13T19:15:51Z","git_url":"git://github.com/MatthieuMEZIL/roslyn.git","ssh_url":"git@github.com:MatthieuMEZIL/roslyn.git","clone_url":"https://github.com/MatthieuMEZIL/roslyn.git","svn_url":"https://github.com/MatthieuMEZIL/roslyn","homepage":"","size":168394,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"13b291024d794c546f246589ed1f8e807265c066","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":29078997,"name":"roslyn","full_name":"dotnet/roslyn","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/roslyn","description":"The .NET Compiler Platform (\"Roslyn\") provides open-source C# and Visual Basic compilers with rich code analysis APIs.","fork":false,"url":"https://api.github.com/repos/dotnet/roslyn","forks_url":"https://api.github.com/repos/dotnet/roslyn/forks","keys_url":"https://api.github.com/repos/dotnet/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/roslyn/teams","hooks_url":"https://api.github.com/repos/dotnet/roslyn/hooks","issue_events_url":"https://api.github.com/repos/dotnet/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/roslyn/events","assignees_url":"https://api.github.com/repos/dotnet/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/roslyn/tags","blobs_url":"https://api.github.com/repos/dotnet/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/roslyn/languages","stargazers_url":"https://api.github.com/repos/dotnet/roslyn/stargazers","contributors_url":"https://api.github.com/repos/dotnet/roslyn/contributors","subscribers_url":"https://api.github.com/repos/dotnet/roslyn/subscribers","subscription_url":"https://api.github.com/repos/dotnet/roslyn/subscription","commits_url":"https://api.github.com/repos/dotnet/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/roslyn/merges","archive_url":"https://api.github.com/repos/dotnet/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/roslyn/downloads","issues_url":"https://api.github.com/repos/dotnet/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/roslyn/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/roslyn/deployments","created_at":"2015-01-11T02:39:03Z","updated_at":"2016-07-13T19:26:06Z","pushed_at":"2016-07-14T00:32:00Z","git_url":"git://github.com/dotnet/roslyn.git","ssh_url":"git@github.com:dotnet/roslyn.git","clone_url":"https://github.com/dotnet/roslyn.git","svn_url":"https://github.com/dotnet/roslyn","homepage":"","size":315463,"stargazers_count":5823,"watchers_count":5823,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1389,"mirror_url":null,"open_issues_count":3024,"forks":1389,"open_issues":3024,"watchers":5823,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/12494"},"html":{"href":"https://github.com/dotnet/roslyn/pull/12494"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/12494"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/12494/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/12494/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/12494/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/955d54b76bb83e6de67998a9db0430651be35d00"}}}}
{"actor":{"display_login":"CyrusNajmabadi"}}