{"action":"created","issue":{"url":"https://api.github.com/repos/6to5/6to5/issues/644","labels_url":"https://api.github.com/repos/6to5/6to5/issues/644/labels{/name}","comments_url":"https://api.github.com/repos/6to5/6to5/issues/644/comments","events_url":"https://api.github.com/repos/6to5/6to5/issues/644/events","html_url":"https://github.com/6to5/6to5/issues/644","id":56006935,"number":644,"title":"Labeled breaks / continues are transformed incorrectly inside lexical scope IIFE","user":{"login":"Arnavion","id":1096010,"avatar_url":"https://avatars.githubusercontent.com/u/1096010?v=3","gravatar_id":"","url":"https://api.github.com/users/Arnavion","html_url":"https://github.com/Arnavion","followers_url":"https://api.github.com/users/Arnavion/followers","following_url":"https://api.github.com/users/Arnavion/following{/other_user}","gists_url":"https://api.github.com/users/Arnavion/gists{/gist_id}","starred_url":"https://api.github.com/users/Arnavion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arnavion/subscriptions","organizations_url":"https://api.github.com/users/Arnavion/orgs","repos_url":"https://api.github.com/users/Arnavion/repos","events_url":"https://api.github.com/users/Arnavion/events{/privacy}","received_events_url":"https://api.github.com/users/Arnavion/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":null,"comments":8,"created_at":"2015-01-30T08:29:18Z","updated_at":"2015-01-31T09:34:54Z","closed_at":"2015-01-30T09:51:27Z","body":"That is, they aren't transformed at all.\r\n\r\nOriginal:\r\n```javascript\r\n(function () {\r\n  loop1:\r\n  for (let j = 0; j < 10; j++) {\r\n    for (let i = 0; i < 10; i++) {\r\n      // Force an IIFE to capture i\r\n      setTimeout(function () { console.log(i); }, 0);\r\n\r\n      break loop1;\r\n      continue loop1;\r\n    }\r\n  }\r\n})();\r\n```\r\n\r\nTransformed:\r\n```javascript\r\n\"use strict\";\r\n\r\n(function () {\r\n  loop1: for (var j = 0; j < 10; j++) {\r\n    for (var i = 0; i < 10; i++) {\r\n      (function (i) {\r\n        // Force an IIFE to capture i\r\n        setTimeout(function () {\r\n          console.log(i);\r\n        }, 0);\r\n        break loop1;\r\n        continue loop1;\r\n      })(i);\r\n    }\r\n  }\r\n})();\r\n```\r\n\r\nThe loop1 label is invalid inside the IIFE. It needs a similar transformation to return or unlabeled break and continue, eg:\r\n\r\n```javascript\r\n\"use strict\";\r\n\r\n(function () {\r\n  loop1: for (var j = 0; j < 10; j++) {\r\n    for (var i = 0; i < 10; i++) {\r\n      var _ret = (function (i) {\r\n        // Force an IIFE to capture i\r\n        setTimeout(function () {\r\n          console.log(i);\r\n        }, 0);\r\n        return \"break|loop1\";\r\n        return \"continue|loop1\";\r\n      })(i);\r\n\r\n      switch (_ret) {\r\n        case \"break|loop1\":\r\n          break loop1;\r\n        case \"continue|loop1\":\r\n          continue loop1;\r\n      }\r\n    }\r\n  }\r\n})();\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/6to5/6to5/issues/comments/72311130","html_url":"https://github.com/6to5/6to5/issues/644#issuecomment-72311130","issue_url":"https://api.github.com/repos/6to5/6to5/issues/644","id":72311130,"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-31T09:34:54Z","updated_at":"2015-01-31T09:34:54Z","body":"@Arnavion Looks like the return value checks are getting lost somewhere. I'll need to wrap my head around the transformations as they're quite fragile."}}