{"action":"created","issue":{"url":"https://api.github.com/repos/t2ym/thin-hook/issues/111","repository_url":"https://api.github.com/repos/t2ym/thin-hook","labels_url":"https://api.github.com/repos/t2ym/thin-hook/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/t2ym/thin-hook/issues/111/comments","events_url":"https://api.github.com/repos/t2ym/thin-hook/issues/111/events","html_url":"https://github.com/t2ym/thin-hook/issues/111","id":259431295,"number":111,"title":"Hooked ES6 compatibility table shows 92% while the native Chrome shows 97%","user":{"login":"t2ym","id":16043714,"avatar_url":"https://avatars0.githubusercontent.com/u/16043714?v=4","gravatar_id":"","url":"https://api.github.com/users/t2ym","html_url":"https://github.com/t2ym","followers_url":"https://api.github.com/users/t2ym/followers","following_url":"https://api.github.com/users/t2ym/following{/other_user}","gists_url":"https://api.github.com/users/t2ym/gists{/gist_id}","starred_url":"https://api.github.com/users/t2ym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t2ym/subscriptions","organizations_url":"https://api.github.com/users/t2ym/orgs","repos_url":"https://api.github.com/users/t2ym/repos","events_url":"https://api.github.com/users/t2ym/events{/privacy}","received_events_url":"https://api.github.com/users/t2ym/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-09-21T09:25:11Z","updated_at":"2017-09-22T03:07:37Z","closed_at":null,"author_association":"OWNER","body":"Hooked [ES6 compatibility table](https://kangax.github.io/compat-table/es6/) shows 92% while the native Chrome shows 97%\r\n\r\n### One of the failures as an example:\r\n- destructuring, parameters, with generator instances (slightly modified for the fix demonstration)\r\n```javascript\r\nreturn function([a, b, c = 3]) {\r\n  return a === 1 && b === 2 && c === 3;\r\n}(function*(){ yield 1; yield 2; }());\r\n```\r\n  - hooked version (not working)\r\n```javascript\r\nfunction anonymous() {\r\nreturn __hook__((...args) =>\r\n  (__hook__(() => {\r\n    return __hook__(function ([a, b, c]) {\r\n      return __hook__(([a, b, c]) => {\r\n        return a === 1 && b === 2 && c === 3;\r\n      }, this, arguments, 'Function');\r\n    }, this, [__hook__(function* () {\r\n        yield* __hook__(function* () {\r\n          yield 1;\r\n          yield 2;\r\n        }, this, arguments, 'Function');\r\n      }, this, [], 'Function', 0)], 'Function', 0);\r\n  }, this, args, 'Function')), this, [arguments], 'Function', 0);\r\n}\r\n```\r\n  - Root cause: The generator function as the argument is called **2 ROUNDS** by the outer and the inner function argument `[a,b,c]`.  The second call results in a sequence of all `undefined` values.\r\n  - Possible Fix: Call the generator function only once at either the outer or the inner function.\r\n```javascript\r\nfunction anonymous() {\r\nreturn __hook__((...args) =>\r\n  (__hook__(() => {\r\n    return __hook__(function () { // REMOVE ARGUMENTS\r\n      return __hook__(([a, b, c = 3]) => {\r\n        return a === 1 && b === 2 && c === 3;\r\n      }, this, arguments, 'Function');\r\n    }, this, [__hook__(function* () {\r\n        yield* __hook__(function* () {\r\n          yield 1;\r\n          yield 2;\r\n        }, this, arguments, 'Function');\r\n      }, this, [], 'Function', 0)], 'Function', 0);\r\n  }, this, args, 'Function')), this, [arguments], 'Function', 0);\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/t2ym/thin-hook/issues/comments/331338317","html_url":"https://github.com/t2ym/thin-hook/issues/111#issuecomment-331338317","issue_url":"https://api.github.com/repos/t2ym/thin-hook/issues/111","id":331338317,"user":{"login":"t2ym","id":16043714,"avatar_url":"https://avatars0.githubusercontent.com/u/16043714?v=4","gravatar_id":"","url":"https://api.github.com/users/t2ym","html_url":"https://github.com/t2ym","followers_url":"https://api.github.com/users/t2ym/followers","following_url":"https://api.github.com/users/t2ym/following{/other_user}","gists_url":"https://api.github.com/users/t2ym/gists{/gist_id}","starred_url":"https://api.github.com/users/t2ym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t2ym/subscriptions","organizations_url":"https://api.github.com/users/t2ym/orgs","repos_url":"https://api.github.com/users/t2ym/repos","events_url":"https://api.github.com/users/t2ym/events{/privacy}","received_events_url":"https://api.github.com/users/t2ym/received_events","type":"User","site_admin":false},"created_at":"2017-09-22T03:07:37Z","updated_at":"2017-09-22T03:07:37Z","author_association":"OWNER","body":"## Failure on class extending expressions\r\n- class extending expressions\r\n```javascript\r\nvar B;\r\nclass C extends (B = class {}) {}\r\nreturn new C() instanceof B\r\n  && B.isPrototypeOf(C);\r\n```"}}
{"actor":{"display_login":"t2ym"}}