{"action":"created","comment":{"url":"https://api.github.com/repos/angular/angular/pulls/comments/74356004","id":74356004,"diff_hunk":"@@ -378,6 +419,54 @@ class _AstToIrVisitor implements cdAst.AstVisitor {\n       }\n     });\n   }\n+\n+  private needsTemporary(ast: cdAst.AST): boolean {\n+    let visit = (visitor: cdAst.AstVisitor, ast: cdAst.AST): boolean => {\n+      return ast && (this._nodeMap.get(ast) || ast).visit(visitor);\n+    };\n+    let visitAll = (visitor: cdAst.AstVisitor, ast: cdAst.AST[]): boolean => {\n+      return ast.some(ast => visit(visitor, ast));\n+    };\n+    return ast.visit({\n+      visitBinary(ast: cdAst.Binary):\n+          boolean{return visit(this, ast.left) || visit(this, ast.right);},\n+      visitChain(ast: cdAst.Chain) { return false; },\n+      visitConditional(ast: cdAst.Conditional):\n+          boolean{return visit(this, ast.condition) || visit(this, ast.trueExp) ||\n+                      visit(this, ast.falseExp);},\n+      visitFunctionCall(ast: cdAst.FunctionCall) { return true; },\n+      visitImplicitReceiver(ast: cdAst.ImplicitReceiver) { return false; },\n+      visitInterpolation(ast: cdAst.Interpolation) { return visitAll(this, ast.expressions); },\n+      visitKeyedRead(ast: cdAst.KeyedRead) { return false; },\n+      visitKeyedWrite(ast: cdAst.KeyedWrite) { return false; },\n+      visitLiteralArray(ast: cdAst.LiteralArray) { return true; },\n+      visitLiteralMap(ast: cdAst.LiteralMap) { return true; },\n+      visitLiteralPrimitive(ast: cdAst.LiteralPrimitive) { return false; },\n+      visitMethodCall(ast: cdAst.MethodCall) { return true; },\n+      visitPipe(ast: cdAst.BindingPipe) { return true; },\n+      visitPrefixNot(ast: cdAst.PrefixNot) { return visit(this, ast.expression); },\n+      visitPropertyRead(ast: cdAst.PropertyRead) { return false; },\n+      visitPropertyWrite(ast: cdAst.PropertyWrite) { return false; },\n+      visitQuote(ast: cdAst.Quote) { return false; },\n+      visitSafeMethodCall(ast: cdAst.SafeMethodCall) { return true; },\n+      visitSafePropertyRead(ast: cdAst.SafePropertyRead) { return false; }\n+    });\n+  }\n+\n+  private allocateTemporary(): o.ReadVarExpr {\n+    const tempNumber = this._currentTemporary++;\n+    if (this._currentTemporary > this.temporaries) {\n+      this.temporaries = this._currentTemporary;\n+    }\n+    return new o.ReadVarExpr(temporaryName(this.bindingIndex, tempNumber));\n+  }\n+\n+  private releaseTemporary(temporary: o.ReadVarExpr) {\n+    this._currentTemporary--;\n+    if (temporary.name != temporaryName(this.bindingIndex, this._currentTemporary)) {\n+      throw new BaseException(`Temporary ${temporary.name} released out of order`);","path":"modules/@angular/compiler/src/view_compiler/expression_converter.ts","position":187,"original_position":187,"commit_id":"fa5fce1f081b89954042253cc82a5ff65d97b851","original_commit_id":"fa5fce1f081b89954042253cc82a5ff65d97b851","user":{"login":"vicb","id":248818,"avatar_url":"https://avatars.githubusercontent.com/u/248818?v=3","gravatar_id":"","url":"https://api.github.com/users/vicb","html_url":"https://github.com/vicb","followers_url":"https://api.github.com/users/vicb/followers","following_url":"https://api.github.com/users/vicb/following{/other_user}","gists_url":"https://api.github.com/users/vicb/gists{/gist_id}","starred_url":"https://api.github.com/users/vicb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vicb/subscriptions","organizations_url":"https://api.github.com/users/vicb/orgs","repos_url":"https://api.github.com/users/vicb/repos","events_url":"https://api.github.com/users/vicb/events{/privacy}","received_events_url":"https://api.github.com/users/vicb/received_events","type":"User","site_admin":false},"body":"new Error ? unless this is for consistency","created_at":"2016-08-11T00:31:43Z","updated_at":"2016-08-11T00:31:43Z","html_url":"https://github.com/angular/angular/pull/10657#discussion_r74356004","pull_request_url":"https://api.github.com/repos/angular/angular/pulls/10657","_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/comments/74356004"},"html":{"href":"https://github.com/angular/angular/pull/10657#discussion_r74356004"},"pull_request":{"href":"https://api.github.com/repos/angular/angular/pulls/10657"}}},"pull_request":{"url":"https://api.github.com/repos/angular/angular/pulls/10657","id":80883339,"html_url":"https://github.com/angular/angular/pull/10657","diff_url":"https://github.com/angular/angular/pull/10657.diff","patch_url":"https://github.com/angular/angular/pull/10657.patch","issue_url":"https://api.github.com/repos/angular/angular/issues/10657","number":10657,"state":"open","locked":false,"title":"fix(compiler): Generate temporary variables for guarded expressions","user":{"login":"chuckjaz","id":372013,"avatar_url":"https://avatars.githubusercontent.com/u/372013?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckjaz","html_url":"https://github.com/chuckjaz","followers_url":"https://api.github.com/users/chuckjaz/followers","following_url":"https://api.github.com/users/chuckjaz/following{/other_user}","gists_url":"https://api.github.com/users/chuckjaz/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckjaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckjaz/subscriptions","organizations_url":"https://api.github.com/users/chuckjaz/orgs","repos_url":"https://api.github.com/users/chuckjaz/repos","events_url":"https://api.github.com/users/chuckjaz/events{/privacy}","received_events_url":"https://api.github.com/users/chuckjaz/received_events","type":"User","site_admin":false},"body":"**Please check if the PR fulfills these requirements**\r\n- [x] The commit message follows our guidelines: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit-message-format\r\n- [x] Tests for the changes have been added (for bug fixes / features)\r\n- [ ] Docs have been added / updated (for bug fixes / features)\r\n\r\n\r\n**What kind of change does this PR introduce?** (check one with \"x\")\r\n```\r\n[x] Bugfix\r\n[ ] Feature\r\n[ ] Code style update (formatting, local variables)\r\n[ ] Refactoring (no functional changes, no api changes)\r\n[ ] Build related changes\r\n[ ] CI related changes\r\n[ ] Other... Please describe:\r\n```\r\n\r\n**What is the current behavior?** (You can also link to an open issue here)\r\n\r\nWhen generating code for null guarded expressions (using the `?.` operator) pipes and method calls are called twice. This can lead to incorrect behavior for pipes where the pipe might change value for the second invocation.\r\n\r\n**What is the new behavior?**\r\n\r\nPipes and method calls are now only evaluated once and the result is saved in a temporary variable.\r\n\r\n**Does this PR introduce a breaking change?** (check one with \"x\")\r\n```\r\n[ ] Yes\r\n[x] No\r\n```\r\n\r\nFixes: #10639","created_at":"2016-08-10T23:11:07Z","updated_at":"2016-08-11T00:31:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cea62f6aba50c5ea718c96edc2236f48409e6bd7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/angular/angular/pulls/10657/commits","review_comments_url":"https://api.github.com/repos/angular/angular/pulls/10657/comments","review_comment_url":"https://api.github.com/repos/angular/angular/pulls/comments{/number}","comments_url":"https://api.github.com/repos/angular/angular/issues/10657/comments","statuses_url":"https://api.github.com/repos/angular/angular/statuses/fa5fce1f081b89954042253cc82a5ff65d97b851","head":{"label":"chuckjaz:issue10639","ref":"issue10639","sha":"fa5fce1f081b89954042253cc82a5ff65d97b851","user":{"login":"chuckjaz","id":372013,"avatar_url":"https://avatars.githubusercontent.com/u/372013?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckjaz","html_url":"https://github.com/chuckjaz","followers_url":"https://api.github.com/users/chuckjaz/followers","following_url":"https://api.github.com/users/chuckjaz/following{/other_user}","gists_url":"https://api.github.com/users/chuckjaz/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckjaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckjaz/subscriptions","organizations_url":"https://api.github.com/users/chuckjaz/orgs","repos_url":"https://api.github.com/users/chuckjaz/repos","events_url":"https://api.github.com/users/chuckjaz/events{/privacy}","received_events_url":"https://api.github.com/users/chuckjaz/received_events","type":"User","site_admin":false},"repo":{"id":50690962,"name":"angular","full_name":"chuckjaz/angular","owner":{"login":"chuckjaz","id":372013,"avatar_url":"https://avatars.githubusercontent.com/u/372013?v=3","gravatar_id":"","url":"https://api.github.com/users/chuckjaz","html_url":"https://github.com/chuckjaz","followers_url":"https://api.github.com/users/chuckjaz/followers","following_url":"https://api.github.com/users/chuckjaz/following{/other_user}","gists_url":"https://api.github.com/users/chuckjaz/gists{/gist_id}","starred_url":"https://api.github.com/users/chuckjaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chuckjaz/subscriptions","organizations_url":"https://api.github.com/users/chuckjaz/orgs","repos_url":"https://api.github.com/users/chuckjaz/repos","events_url":"https://api.github.com/users/chuckjaz/events{/privacy}","received_events_url":"https://api.github.com/users/chuckjaz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chuckjaz/angular","description":"","fork":true,"url":"https://api.github.com/repos/chuckjaz/angular","forks_url":"https://api.github.com/repos/chuckjaz/angular/forks","keys_url":"https://api.github.com/repos/chuckjaz/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chuckjaz/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chuckjaz/angular/teams","hooks_url":"https://api.github.com/repos/chuckjaz/angular/hooks","issue_events_url":"https://api.github.com/repos/chuckjaz/angular/issues/events{/number}","events_url":"https://api.github.com/repos/chuckjaz/angular/events","assignees_url":"https://api.github.com/repos/chuckjaz/angular/assignees{/user}","branches_url":"https://api.github.com/repos/chuckjaz/angular/branches{/branch}","tags_url":"https://api.github.com/repos/chuckjaz/angular/tags","blobs_url":"https://api.github.com/repos/chuckjaz/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chuckjaz/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chuckjaz/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/chuckjaz/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chuckjaz/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/chuckjaz/angular/languages","stargazers_url":"https://api.github.com/repos/chuckjaz/angular/stargazers","contributors_url":"https://api.github.com/repos/chuckjaz/angular/contributors","subscribers_url":"https://api.github.com/repos/chuckjaz/angular/subscribers","subscription_url":"https://api.github.com/repos/chuckjaz/angular/subscription","commits_url":"https://api.github.com/repos/chuckjaz/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/chuckjaz/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/chuckjaz/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/chuckjaz/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/chuckjaz/angular/contents/{+path}","compare_url":"https://api.github.com/repos/chuckjaz/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chuckjaz/angular/merges","archive_url":"https://api.github.com/repos/chuckjaz/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chuckjaz/angular/downloads","issues_url":"https://api.github.com/repos/chuckjaz/angular/issues{/number}","pulls_url":"https://api.github.com/repos/chuckjaz/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/chuckjaz/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/chuckjaz/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chuckjaz/angular/labels{/name}","releases_url":"https://api.github.com/repos/chuckjaz/angular/releases{/id}","deployments_url":"https://api.github.com/repos/chuckjaz/angular/deployments","created_at":"2016-01-29T21:00:52Z","updated_at":"2016-01-29T21:01:07Z","pushed_at":"2016-08-10T23:24:42Z","git_url":"git://github.com/chuckjaz/angular.git","ssh_url":"git@github.com:chuckjaz/angular.git","clone_url":"https://github.com/chuckjaz/angular.git","svn_url":"https://github.com/chuckjaz/angular","homepage":"https://angular.io","size":142286,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":"angular:master","ref":"master","sha":"6f4ee6101c937e1bc396ffede969c437706554a8","user":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"repo":{"id":24195339,"name":"angular","full_name":"angular/angular","owner":{"login":"angular","id":139426,"avatar_url":"https://avatars.githubusercontent.com/u/139426?v=3","gravatar_id":"","url":"https://api.github.com/users/angular","html_url":"https://github.com/angular","followers_url":"https://api.github.com/users/angular/followers","following_url":"https://api.github.com/users/angular/following{/other_user}","gists_url":"https://api.github.com/users/angular/gists{/gist_id}","starred_url":"https://api.github.com/users/angular/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angular/subscriptions","organizations_url":"https://api.github.com/users/angular/orgs","repos_url":"https://api.github.com/users/angular/repos","events_url":"https://api.github.com/users/angular/events{/privacy}","received_events_url":"https://api.github.com/users/angular/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/angular/angular","description":"","fork":false,"url":"https://api.github.com/repos/angular/angular","forks_url":"https://api.github.com/repos/angular/angular/forks","keys_url":"https://api.github.com/repos/angular/angular/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angular/angular/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angular/angular/teams","hooks_url":"https://api.github.com/repos/angular/angular/hooks","issue_events_url":"https://api.github.com/repos/angular/angular/issues/events{/number}","events_url":"https://api.github.com/repos/angular/angular/events","assignees_url":"https://api.github.com/repos/angular/angular/assignees{/user}","branches_url":"https://api.github.com/repos/angular/angular/branches{/branch}","tags_url":"https://api.github.com/repos/angular/angular/tags","blobs_url":"https://api.github.com/repos/angular/angular/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angular/angular/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angular/angular/git/refs{/sha}","trees_url":"https://api.github.com/repos/angular/angular/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angular/angular/statuses/{sha}","languages_url":"https://api.github.com/repos/angular/angular/languages","stargazers_url":"https://api.github.com/repos/angular/angular/stargazers","contributors_url":"https://api.github.com/repos/angular/angular/contributors","subscribers_url":"https://api.github.com/repos/angular/angular/subscribers","subscription_url":"https://api.github.com/repos/angular/angular/subscription","commits_url":"https://api.github.com/repos/angular/angular/commits{/sha}","git_commits_url":"https://api.github.com/repos/angular/angular/git/commits{/sha}","comments_url":"https://api.github.com/repos/angular/angular/comments{/number}","issue_comment_url":"https://api.github.com/repos/angular/angular/issues/comments{/number}","contents_url":"https://api.github.com/repos/angular/angular/contents/{+path}","compare_url":"https://api.github.com/repos/angular/angular/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angular/angular/merges","archive_url":"https://api.github.com/repos/angular/angular/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angular/angular/downloads","issues_url":"https://api.github.com/repos/angular/angular/issues{/number}","pulls_url":"https://api.github.com/repos/angular/angular/pulls{/number}","milestones_url":"https://api.github.com/repos/angular/angular/milestones{/number}","notifications_url":"https://api.github.com/repos/angular/angular/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angular/angular/labels{/name}","releases_url":"https://api.github.com/repos/angular/angular/releases{/id}","deployments_url":"https://api.github.com/repos/angular/angular/deployments","created_at":"2014-09-18T16:12:01Z","updated_at":"2016-08-11T00:23:22Z","pushed_at":"2016-08-10T23:58:34Z","git_url":"git://github.com/angular/angular.git","ssh_url":"git@github.com:angular/angular.git","clone_url":"https://github.com/angular/angular.git","svn_url":"https://github.com/angular/angular","homepage":"https://angular.io","size":642596,"stargazers_count":14719,"watchers_count":14719,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3780,"mirror_url":null,"open_issues_count":1138,"forks":3780,"open_issues":1138,"watchers":14719,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/angular/angular/pulls/10657"},"html":{"href":"https://github.com/angular/angular/pull/10657"},"issue":{"href":"https://api.github.com/repos/angular/angular/issues/10657"},"comments":{"href":"https://api.github.com/repos/angular/angular/issues/10657/comments"},"review_comments":{"href":"https://api.github.com/repos/angular/angular/pulls/10657/comments"},"review_comment":{"href":"https://api.github.com/repos/angular/angular/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/angular/angular/pulls/10657/commits"},"statuses":{"href":"https://api.github.com/repos/angular/angular/statuses/fa5fce1f081b89954042253cc82a5ff65d97b851"}}}}
{"actor":{"display_login":"vicb"}}