{"action":"created","issue":{"url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/1508","repository_url":"https://api.github.com/repos/bridgedotnet/Bridge","labels_url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/1508/labels{/name}","comments_url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/1508/comments","events_url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/1508/events","html_url":"https://github.com/bridgedotnet/Bridge/issues/1508","id":163554256,"number":1508,"title":"Double temporary variables declared in some cases.","user":{"login":"michaelcheers","id":10186738,"avatar_url":"https://avatars.githubusercontent.com/u/10186738?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelcheers","html_url":"https://github.com/michaelcheers","followers_url":"https://api.github.com/users/michaelcheers/followers","following_url":"https://api.github.com/users/michaelcheers/following{/other_user}","gists_url":"https://api.github.com/users/michaelcheers/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelcheers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelcheers/subscriptions","organizations_url":"https://api.github.com/users/michaelcheers/orgs","repos_url":"https://api.github.com/users/michaelcheers/repos","events_url":"https://api.github.com/users/michaelcheers/events{/privacy}","received_events_url":"https://api.github.com/users/michaelcheers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-03T09:17:51Z","updated_at":"2016-07-12T21:17:45Z","closed_at":null,"body":"### Expected\r\n\r\nThere be 1 variable named $t.\r\n\r\n### Actual\r\n\r\nThere are 2 variables named $t.\r\n\r\n### Steps To Reproduce\r\n[Live Bridge](http://live.bridge.net/#7da17bd67cdb8f3fb426f413f9688611)\r\n\r\n```csharp\r\n/// <summary>\r\n/// Creates a simple class\r\n/// </summary>\r\npublic static class App\r\n{\r\n    public static void Main()\r\n    {\r\n        DoIt();\r\n    }\r\n    \r\n    \r\n    public static int[] UpTo(this int value)\r\n    {\r\n        int[] array = new int[value];\r\n        for (int n = 0; n < value; n++)\r\n            array[n] = n;\r\n        return array;\r\n    }\r\n    \r\n    public static bool DoIt ()\r\n    {\r\n        for (int dimensionNActual = 0; dimensionNActual < 4; dimensionNActual++)\r\n            foreach (var dimensionN in dimensionNActual.UpTo())\r\n            {\r\n                Action action;\r\n                int xOut = 0;\r\n                action = () => ++xOut;\r\n                return true;\r\n            }\r\n        return false;\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/comments/232184423","html_url":"https://github.com/bridgedotnet/Bridge/issues/1508#issuecomment-232184423","issue_url":"https://api.github.com/repos/bridgedotnet/Bridge/issues/1508","id":232184423,"user":{"login":"LeonidVeriga","id":11466613,"avatar_url":"https://avatars.githubusercontent.com/u/11466613?v=3","gravatar_id":"","url":"https://api.github.com/users/LeonidVeriga","html_url":"https://github.com/LeonidVeriga","followers_url":"https://api.github.com/users/LeonidVeriga/followers","following_url":"https://api.github.com/users/LeonidVeriga/following{/other_user}","gists_url":"https://api.github.com/users/LeonidVeriga/gists{/gist_id}","starred_url":"https://api.github.com/users/LeonidVeriga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeonidVeriga/subscriptions","organizations_url":"https://api.github.com/users/LeonidVeriga/orgs","repos_url":"https://api.github.com/users/LeonidVeriga/repos","events_url":"https://api.github.com/users/LeonidVeriga/events{/privacy}","received_events_url":"https://api.github.com/users/LeonidVeriga/received_events","type":"User","site_admin":false},"created_at":"2016-07-12T21:17:44Z","updated_at":"2016-07-12T21:17:44Z","body":"@michaelcheers,\r\n\r\nThe current 1.14 Bridge Live generates:\r\n```\r\n            doIt: function () {\r\n                var $t, $t1, $t2;\r\n                for (var dimensionNActual = 0; dimensionNActual < 4; dimensionNActual = (dimensionNActual + 1) | 0) {\r\n                    var $t = (function () {\r\n                        $t1 = Bridge.getEnumerator(Demo.App.upTo(dimensionNActual));\r\n                        while ($t1.moveNext()) {\r\n                            var $t2 = (function () {\r\n                                var dimensionN = $t1.getCurrent();\r\n                                var action;\r\n                                var xOut = 0;\r\n                                action = function () {\r\n                                    ((xOut = (xOut + 1) | 0));\r\n                                };\r\n                                return {jump: 3, v: true};\r\n                            }).call(this) || {};\r\n                            if($t2.jump == 3) return {jump: 3, v: $t2.v};\r\n                        }\r\n                    }).call(this) || {};\r\n                    if($t.jump == 3) return $t.v;\r\n                }\r\n                return false;\r\n            }\r\n```\r\n\r\nCreating three variables is correct `var $t, $t1, $t2;`\r\nHowever, inside the `for` loop, `$t` and `$t2` created again with `var`. We will fix this:\r\n```\r\nvar $t = (function () {\r\n...\r\n   var $t2 = (function () {\r\n....\r\n```\r\n"}}
{"actor":{"display_login":"LeonidVeriga"}}