{"action":"created","issue":{"url":"https://api.github.com/repos/6to5/6to5/issues/564","labels_url":"https://api.github.com/repos/6to5/6to5/issues/564/labels{/name}","comments_url":"https://api.github.com/repos/6to5/6to5/issues/564/comments","events_url":"https://api.github.com/repos/6to5/6to5/issues/564/events","html_url":"https://github.com/6to5/6to5/issues/564","id":55092847,"number":564,"title":"Scoping issue with const/let and switch statement","user":{"login":"assaf","id":5158,"avatar_url":"https://avatars.githubusercontent.com/u/5158?v=3","gravatar_id":"","url":"https://api.github.com/users/assaf","html_url":"https://github.com/assaf","followers_url":"https://api.github.com/users/assaf/followers","following_url":"https://api.github.com/users/assaf/following{/other_user}","gists_url":"https://api.github.com/users/assaf/gists{/gist_id}","starred_url":"https://api.github.com/users/assaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/assaf/subscriptions","organizations_url":"https://api.github.com/users/assaf/orgs","repos_url":"https://api.github.com/users/assaf/repos","events_url":"https://api.github.com/users/assaf/events{/privacy}","received_events_url":"https://api.github.com/users/assaf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/6to5/6to5/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/6to5/6to5/labels/transformation","name":"transformation","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/6to5/6to5/milestones/3","labels_url":"https://api.github.com/repos/6to5/6to5/milestones/3/labels","id":929918,"number":3,"title":"3.0.0","description":"","creator":{"login":"thejameskyle","id":952783,"avatar_url":"https://avatars.githubusercontent.com/u/952783?v=3","gravatar_id":"","url":"https://api.github.com/users/thejameskyle","html_url":"https://github.com/thejameskyle","followers_url":"https://api.github.com/users/thejameskyle/followers","following_url":"https://api.github.com/users/thejameskyle/following{/other_user}","gists_url":"https://api.github.com/users/thejameskyle/gists{/gist_id}","starred_url":"https://api.github.com/users/thejameskyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thejameskyle/subscriptions","organizations_url":"https://api.github.com/users/thejameskyle/orgs","repos_url":"https://api.github.com/users/thejameskyle/repos","events_url":"https://api.github.com/users/thejameskyle/events{/privacy}","received_events_url":"https://api.github.com/users/thejameskyle/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":19,"state":"open","created_at":"2015-01-10T19:00:41Z","updated_at":"2015-01-26T19:55:08Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-01-21T23:24:29Z","updated_at":"2015-01-28T02:51:30Z","closed_at":"2015-01-26T04:53:45Z","body":"Minimal test case:\r\n\r\n```js\r\nfunction fail() {\r\n  if (true) {\r\n    const y = 1;\r\n    switch (1) {\r\n      case 1: {\r\n        function x() { return y };\r\n        break;\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nThe error I get is:\r\n\r\n```\r\n        if (_ret === \"break\") break _loop;\r\n                                    ^^^^^\r\nSyntaxError: Undefined label '_loop'\r\n```\r\n\r\nThis happens when:\r\n- Inside a `case` statement\r\n- That ends with a `break`\r\n- And contains a function that accesses a variable in the enclosing scope\r\n- Which is not the same scope as the function (i.e. scoped to condition, for loop, try/catch)\r\n- And is defined with local scope (`const` or `let`)\r\n"},"comment":{"url":"https://api.github.com/repos/6to5/6to5/issues/comments/71772452","html_url":"https://github.com/6to5/6to5/issues/564#issuecomment-71772452","issue_url":"https://api.github.com/repos/6to5/6to5/issues/564","id":71772452,"user":{"login":"sebmck","id":853712,"avatar_url":"https://avatars.githubusercontent.com/u/853712?v=3","gravatar_id":"","url":"https://api.github.com/users/sebmck","html_url":"https://github.com/sebmck","followers_url":"https://api.github.com/users/sebmck/followers","following_url":"https://api.github.com/users/sebmck/following{/other_user}","gists_url":"https://api.github.com/users/sebmck/gists{/gist_id}","starred_url":"https://api.github.com/users/sebmck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebmck/subscriptions","organizations_url":"https://api.github.com/users/sebmck/orgs","repos_url":"https://api.github.com/users/sebmck/repos","events_url":"https://api.github.com/users/sebmck/events{/privacy}","received_events_url":"https://api.github.com/users/sebmck/received_events","type":"User","site_admin":false},"created_at":"2015-01-28T02:51:30Z","updated_at":"2015-01-28T02:51:30Z","body":"Fixed as of 3.0.0"}}