{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/28438927","id":28438927,"diff_hunk":"@@ -881,6 +886,135 @@ public override BoundNode VisitNullCoalescingOperator(BoundNullCoalescingOperato\n             return UpdateExpression(builder, node.Update(left, right, node.LeftConversion, node.Type));\n         }\n \n+        public override BoundNode VisitLoweredConditionalAccess(BoundLoweredConditionalAccess node)\n+        {\n+            var receiverRefKind = ReceiverSpillRefKind(node.Receiver);\n+            \n+            BoundSpillSequenceBuilder receiverBuilder = null;\n+            var receiver = VisitExpression(ref receiverBuilder, node.Receiver);\n+\n+            BoundSpillSequenceBuilder whenNotNullBuilder = null;\n+            var whenNotNull = VisitExpression(ref whenNotNullBuilder, node.WhenNotNull);\n+\n+            BoundSpillSequenceBuilder whenNullBuilder = null;\n+            var whenNullOpt = VisitExpression(ref whenNullBuilder, node.WhenNullOpt);\n+\n+            if (whenNotNullBuilder == null && whenNullBuilder == null)\n+            {\n+                return UpdateExpression(receiverBuilder, node.Update(receiver, whenNotNull, whenNullOpt, node.Id, node.Type));\n+            }\n+\n+            if (receiverBuilder == null) receiverBuilder = new BoundSpillSequenceBuilder();\n+            if (whenNotNullBuilder == null) whenNotNullBuilder = new BoundSpillSequenceBuilder();\n+            if (whenNullBuilder == null) whenNullBuilder = new BoundSpillSequenceBuilder();\n+            \n+\n+            BoundExpression condition;\n+            if (receiver.Type.IsReferenceType || receiverRefKind == RefKind.None)\n+            {\n+                // spill to a clone\n+                receiver = Spill(receiverBuilder, receiver, RefKind.None);\n+                condition = _F.ObjectNotEqual(\n+                    _F.Convert(_F.SpecialType(SpecialType.System_Object), receiver),\n+                    _F.Null(_F.SpecialType(SpecialType.System_Object)));\n+            }\n+            else\n+            {\n+                receiver = Spill(receiverBuilder, receiver, RefKind.Ref);\n+\n+                var clone = _F.SynthesizedLocal(receiver.Type, _F.Syntax, refKind: RefKind.None, kind: SynthesizedLocalKind.AwaitSpill);\n+                receiverBuilder.AddLocal(clone, _F.Diagnostics);\n+\n+                //  (object)default(T) != null\n+                var isNotClass = _F.ObjectNotEqual(\n+                                _F.Convert(_F.SpecialType(SpecialType.System_Object), _F.Default(receiver.Type)),\n+                                _F.Null(_F.SpecialType(SpecialType.System_Object)));\n+                \n+                // isNotCalss || {clone = receiver; (object)clone != null}\n+                condition = _F.LogicalOr(\n+                                    isNotClass,\n+                                    _F.Sequence(\n+                                        _F.AssignmentExpression(_F.Local(clone), receiver),\n+                                        _F.ObjectNotEqual(\n+                                            _F.Convert(_F.SpecialType(SpecialType.System_Object), _F.Local(clone)),\n+                                            _F.Null(_F.SpecialType(SpecialType.System_Object))))\n+                                    );\n+\n+                receiver = _F.ComplexConditionalReceiver(receiver, _F.Local(clone));\n+            }\n+            \n+            if (node.Type.SpecialType == SpecialType.System_Void)\n+            {\n+                var wnenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.ExpressionStatement(whenNotNull), substituteTemps: false);\n+                wnenNotNullStatement = ConditionalReceiverReplacer.Replace(wnenNotNullStatement, receiver, node.Id);\n+\n+                Debug.Assert(whenNullOpt == null || !LocalRewriter.ReadIsSideeffecting(whenNullOpt));\n+\n+                receiverBuilder.AddStatement(_F.If(condition, wnenNotNullStatement));\n+\n+                return receiverBuilder.Update(_F.Default(node.Type));\n+            }\n+            else\n+            {\n+                Debug.Assert(_F.Syntax.IsKind(SyntaxKind.AwaitExpression));\n+                var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.AwaitSpill, syntax: _F.Syntax);\n+                var wnenNotNullStatement = UpdateStatement(whenNotNullBuilder, _F.Assignment(_F.Local(tmp), whenNotNull), substituteTemps: false);\n+                wnenNotNullStatement = ConditionalReceiverReplacer.Replace(wnenNotNullStatement, receiver, node.Id);\n+\n+                whenNullOpt = whenNullOpt ?? _F.Default(node.Type);\n+\n+                receiverBuilder.AddLocal(tmp, _F.Diagnostics);\n+                receiverBuilder.AddStatement(\n+                    _F.If(condition,\n+                        wnenNotNullStatement,\n+                        UpdateStatement(whenNullBuilder, _F.Assignment(_F.Local(tmp), whenNullOpt), substituteTemps: false)));\n+\n+                return receiverBuilder.Update(_F.Local(tmp));\n+            }\n+        }\n+\n+        private class ConditionalReceiverReplacer: BoundTreeRewriter\n+        {\n+            private readonly BoundExpression _receiver;\n+            private readonly int _receiverID;","path":"src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AwaitExpressionSpiller.cs","position":106,"original_position":106,"commit_id":"81b8888dcb2435a0357e8b46ebb7b1f0912cb4ba","original_commit_id":"81b8888dcb2435a0357e8b46ebb7b1f0912cb4ba","user":{"login":"AlekseyTs","id":10522107,"avatar_url":"https://avatars.githubusercontent.com/u/10522107?v=3","gravatar_id":"","url":"https://api.github.com/users/AlekseyTs","html_url":"https://github.com/AlekseyTs","followers_url":"https://api.github.com/users/AlekseyTs/followers","following_url":"https://api.github.com/users/AlekseyTs/following{/other_user}","gists_url":"https://api.github.com/users/AlekseyTs/gists{/gist_id}","starred_url":"https://api.github.com/users/AlekseyTs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlekseyTs/subscriptions","organizations_url":"https://api.github.com/users/AlekseyTs/orgs","repos_url":"https://api.github.com/users/AlekseyTs/repos","events_url":"https://api.github.com/users/AlekseyTs/events{/privacy}","received_events_url":"https://api.github.com/users/AlekseyTs/received_events","type":"User","site_admin":false},"body":"_receiverId ?","created_at":"2015-04-15T16:54:42Z","updated_at":"2015-04-15T16:54:42Z","html_url":"https://github.com/dotnet/roslyn/pull/1935#discussion_r28438927","pull_request_url":"https://api.github.com/repos/dotnet/roslyn/pulls/1935","_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments/28438927"},"html":{"href":"https://github.com/dotnet/roslyn/pull/1935#discussion_r28438927"},"pull_request":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/1935"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/roslyn/pulls/1935","id":33133870,"html_url":"https://github.com/dotnet/roslyn/pull/1935","diff_url":"https://github.com/dotnet/roslyn/pull/1935.diff","patch_url":"https://github.com/dotnet/roslyn/pull/1935.patch","issue_url":"https://api.github.com/repos/dotnet/roslyn/issues/1935","number":1935,"state":"open","locked":false,"title":"Improved code generation for ?. in some scenarios (in particular async)","user":{"login":"VSadov","id":8218165,"avatar_url":"https://avatars.githubusercontent.com/u/8218165?v=3","gravatar_id":"","url":"https://api.github.com/users/VSadov","html_url":"https://github.com/VSadov","followers_url":"https://api.github.com/users/VSadov/followers","following_url":"https://api.github.com/users/VSadov/following{/other_user}","gists_url":"https://api.github.com/users/VSadov/gists{/gist_id}","starred_url":"https://api.github.com/users/VSadov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VSadov/subscriptions","organizations_url":"https://api.github.com/users/VSadov/orgs","repos_url":"https://api.github.com/users/VSadov/repos","events_url":"https://api.github.com/users/VSadov/events{/privacy}","received_events_url":"https://api.github.com/users/VSadov/received_events","type":"User","site_admin":false},"body":"The duplicated code emit in the case of async is now gone. Some existing tests now emit 5x times smaller method bodies.\r\nBinary operators with ?. operand can now be fused (and thus avoid intermediate nullables) in more scenarios.\r\n\r\nFixes #825\r\n","created_at":"2015-04-13T03:34:15Z","updated_at":"2015-04-15T16:54:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b96364c50f81932c2d71832a10f3c33b2f0356ca","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/roslyn/pulls/1935/commits","review_comments_url":"https://api.github.com/repos/dotnet/roslyn/pulls/1935/comments","review_comment_url":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/1935/comments","statuses_url":"https://api.github.com/repos/dotnet/roslyn/statuses/81b8888dcb2435a0357e8b46ebb7b1f0912cb4ba","head":{"label":"VSadov:elvisOpt","ref":"elvisOpt","sha":"81b8888dcb2435a0357e8b46ebb7b1f0912cb4ba","user":{"login":"VSadov","id":8218165,"avatar_url":"https://avatars.githubusercontent.com/u/8218165?v=3","gravatar_id":"","url":"https://api.github.com/users/VSadov","html_url":"https://github.com/VSadov","followers_url":"https://api.github.com/users/VSadov/followers","following_url":"https://api.github.com/users/VSadov/following{/other_user}","gists_url":"https://api.github.com/users/VSadov/gists{/gist_id}","starred_url":"https://api.github.com/users/VSadov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VSadov/subscriptions","organizations_url":"https://api.github.com/users/VSadov/orgs","repos_url":"https://api.github.com/users/VSadov/repos","events_url":"https://api.github.com/users/VSadov/events{/privacy}","received_events_url":"https://api.github.com/users/VSadov/received_events","type":"User","site_admin":false},"repo":{"id":30550950,"name":"roslyn","full_name":"VSadov/roslyn","owner":{"login":"VSadov","id":8218165,"avatar_url":"https://avatars.githubusercontent.com/u/8218165?v=3","gravatar_id":"","url":"https://api.github.com/users/VSadov","html_url":"https://github.com/VSadov","followers_url":"https://api.github.com/users/VSadov/followers","following_url":"https://api.github.com/users/VSadov/following{/other_user}","gists_url":"https://api.github.com/users/VSadov/gists{/gist_id}","starred_url":"https://api.github.com/users/VSadov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VSadov/subscriptions","organizations_url":"https://api.github.com/users/VSadov/orgs","repos_url":"https://api.github.com/users/VSadov/repos","events_url":"https://api.github.com/users/VSadov/events{/privacy}","received_events_url":"https://api.github.com/users/VSadov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VSadov/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/VSadov/roslyn","forks_url":"https://api.github.com/repos/VSadov/roslyn/forks","keys_url":"https://api.github.com/repos/VSadov/roslyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VSadov/roslyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VSadov/roslyn/teams","hooks_url":"https://api.github.com/repos/VSadov/roslyn/hooks","issue_events_url":"https://api.github.com/repos/VSadov/roslyn/issues/events{/number}","events_url":"https://api.github.com/repos/VSadov/roslyn/events","assignees_url":"https://api.github.com/repos/VSadov/roslyn/assignees{/user}","branches_url":"https://api.github.com/repos/VSadov/roslyn/branches{/branch}","tags_url":"https://api.github.com/repos/VSadov/roslyn/tags","blobs_url":"https://api.github.com/repos/VSadov/roslyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VSadov/roslyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VSadov/roslyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/VSadov/roslyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VSadov/roslyn/statuses/{sha}","languages_url":"https://api.github.com/repos/VSadov/roslyn/languages","stargazers_url":"https://api.github.com/repos/VSadov/roslyn/stargazers","contributors_url":"https://api.github.com/repos/VSadov/roslyn/contributors","subscribers_url":"https://api.github.com/repos/VSadov/roslyn/subscribers","subscription_url":"https://api.github.com/repos/VSadov/roslyn/subscription","commits_url":"https://api.github.com/repos/VSadov/roslyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/VSadov/roslyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/VSadov/roslyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/VSadov/roslyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/VSadov/roslyn/contents/{+path}","compare_url":"https://api.github.com/repos/VSadov/roslyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VSadov/roslyn/merges","archive_url":"https://api.github.com/repos/VSadov/roslyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VSadov/roslyn/downloads","issues_url":"https://api.github.com/repos/VSadov/roslyn/issues{/number}","pulls_url":"https://api.github.com/repos/VSadov/roslyn/pulls{/number}","milestones_url":"https://api.github.com/repos/VSadov/roslyn/milestones{/number}","notifications_url":"https://api.github.com/repos/VSadov/roslyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VSadov/roslyn/labels{/name}","releases_url":"https://api.github.com/repos/VSadov/roslyn/releases{/id}","created_at":"2015-02-09T18:24:54Z","updated_at":"2015-04-08T16:39:48Z","pushed_at":"2015-04-14T23:20:23Z","git_url":"git://github.com/VSadov/roslyn.git","ssh_url":"git@github.com:VSadov/roslyn.git","clone_url":"https://github.com/VSadov/roslyn.git","svn_url":"https://github.com/VSadov/roslyn","homepage":"","size":65603,"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":"604808fd9e82b507421199715990511a0f9043d6","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}","created_at":"2015-01-11T02:39:03Z","updated_at":"2015-04-15T16:15:59Z","pushed_at":"2015-04-15T16:06:34Z","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":108446,"stargazers_count":1796,"watchers_count":1796,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":402,"mirror_url":null,"open_issues_count":705,"forks":402,"open_issues":705,"watchers":1796,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/1935"},"html":{"href":"https://github.com/dotnet/roslyn/pull/1935"},"issue":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/1935"},"comments":{"href":"https://api.github.com/repos/dotnet/roslyn/issues/1935/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/1935/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/roslyn/pulls/1935/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/roslyn/statuses/81b8888dcb2435a0357e8b46ebb7b1f0912cb4ba"}}}}