{"action":"created","issue":{"url":"https://api.github.com/repos/google/closure-compiler/issues/1656","repository_url":"https://api.github.com/repos/google/closure-compiler","labels_url":"https://api.github.com/repos/google/closure-compiler/issues/1656/labels{/name}","comments_url":"https://api.github.com/repos/google/closure-compiler/issues/1656/comments","events_url":"https://api.github.com/repos/google/closure-compiler/issues/1656/events","html_url":"https://github.com/google/closure-compiler/issues/1656","id":140814815,"number":1656,"title":"Function inlining reuse var name","user":{"login":"tdelmas","id":1955774,"avatar_url":"https://avatars.githubusercontent.com/u/1955774?v=3","gravatar_id":"","url":"https://api.github.com/users/tdelmas","html_url":"https://github.com/tdelmas","followers_url":"https://api.github.com/users/tdelmas/followers","following_url":"https://api.github.com/users/tdelmas/following{/other_user}","gists_url":"https://api.github.com/users/tdelmas/gists{/gist_id}","starred_url":"https://api.github.com/users/tdelmas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tdelmas/subscriptions","organizations_url":"https://api.github.com/users/tdelmas/orgs","repos_url":"https://api.github.com/users/tdelmas/repos","events_url":"https://api.github.com/users/tdelmas/events{/privacy}","received_events_url":"https://api.github.com/users/tdelmas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-14T22:29:23Z","updated_at":"2016-03-14T23:09:56Z","closed_at":null,"body":"When the compiler inlines a function, sometimes a var name is (wrongly?) reused.\r\n`var d` appears twice in that piece of code from example: \r\n```js\r\nvar d = a;\r\nif (d && void 0 !== g) if (a = d) {\r\n  var d = a.results,\r\n```\r\nI'm afraid that the behaviour introduce bugs. (and yes, the second line generated is strange, but, not incorrect)\r\n\r\nFull compiled code:\r\nhttps://searchcode.tdelmas.ovh/searchcode.js\r\nSource code: \r\nhttps://github.com/tdelmas/searchcode_regexpr/blob/master/static/searchcode.js\r\nClosure compiler version: \r\nv20160208 (the current HEAD version has the problem too)"},"comment":{"url":"https://api.github.com/repos/google/closure-compiler/issues/comments/196558801","html_url":"https://github.com/google/closure-compiler/issues/1656#issuecomment-196558801","issue_url":"https://api.github.com/repos/google/closure-compiler/issues/1656","id":196558801,"user":{"login":"dimvar","id":286890,"avatar_url":"https://avatars.githubusercontent.com/u/286890?v=3","gravatar_id":"","url":"https://api.github.com/users/dimvar","html_url":"https://github.com/dimvar","followers_url":"https://api.github.com/users/dimvar/followers","following_url":"https://api.github.com/users/dimvar/following{/other_user}","gists_url":"https://api.github.com/users/dimvar/gists{/gist_id}","starred_url":"https://api.github.com/users/dimvar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimvar/subscriptions","organizations_url":"https://api.github.com/users/dimvar/orgs","repos_url":"https://api.github.com/users/dimvar/repos","events_url":"https://api.github.com/users/dimvar/events{/privacy}","received_events_url":"https://api.github.com/users/dimvar/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T23:09:56Z","updated_at":"2016-03-14T23:09:56Z","body":"@tdelmas I think that the output you posted has been transformed by more passes than just function inlining (eg, the assignment inside the IF condition is probably from another pass). You should use the flag `--print_source_after_each_pass` and look at the code before and after inlining, to see if it makes sense. And then report back here."}}