{"action":"created","issue":{"url":"https://api.github.com/repos/t2ym/thin-hook/issues/1","repository_url":"https://api.github.com/repos/t2ym/thin-hook","labels_url":"https://api.github.com/repos/t2ym/thin-hook/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/t2ym/thin-hook/issues/1/comments","events_url":"https://api.github.com/repos/t2ym/thin-hook/issues/1/events","html_url":"https://github.com/t2ym/thin-hook/issues/1","id":202792526,"number":1,"title":"Syntax error on super in generator functions","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":0,"created_at":"2017-01-24T11:28:40Z","updated_at":"2017-10-09T12:13:39Z","closed_at":null,"author_association":"OWNER","body":"Syntax error on super in generator functions:\r\n\r\n### Input:\r\n```javascript\r\nclass B {\r\n  * generator() { yield * [ 1, 2, 3 ]; }\r\n}\r\nclass A extends B {\r\n  * generator() {\r\n    yield * super.generator();\r\n    yield * [ 4, 5, 6 ];\r\n  }\r\n}\r\n```\r\n\r\n### Output with an error:\r\n```javascript\r\nclass B {\r\n  *generator() {\r\n    yield* __hook__(function* () {\r\n      yield* [ 1, 2, 3 ];\r\n    }, this, arguments);\r\n  }\r\n}\r\nclass A extends B {\r\n  *generator() {\r\n    yield* __hook__(function* () {\r\n      yield* super.generator(); // super keyword is not allowed here\r\n      yield* [ 4, 5, 6 ];\r\n    }, this, arguments);\r\n  }\r\n}\r\n```\r\n\r\n### Workaround: Object.getPrototypeOf(this.constructor).prototype.generator.apply(this, [])\r\n```javascript\r\nclass B {\r\n  *generator() {\r\n    yield* __hook__(function* () {\r\n      yield* [ 1, 2, 3 ];\r\n    }, this, arguments);\r\n  }\r\n}\r\nclass A extends B {\r\n  *generator() {\r\n    yield* __hook__(function* () {\r\n      yield* Object.getPrototypeOf(this.constructor).prototype.generator.apply(this, []);\r\n      yield* [ 4, 5, 6 ];\r\n    }, this, arguments);\r\n  }\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/t2ym/thin-hook/issues/comments/335139990","html_url":"https://github.com/t2ym/thin-hook/issues/1#issuecomment-335139990","issue_url":"https://api.github.com/repos/t2ym/thin-hook/issues/1","id":335139990,"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-10-09T12:13:39Z","updated_at":"2017-10-09T12:13:39Z","author_association":"OWNER","body":"## Possible Fix (not verified)\r\n```javascript\r\n{\r\n  class B {\r\n    *generator() {\r\n      yield* __hook__(function* () {\r\n        yield* [\r\n          1,\r\n          2,\r\n          3\r\n        ];\r\n      }, this, arguments, '../gen1.js,B,generator');\r\n    }\r\n  }\r\n  class A extends B {\r\n    *generator() {\r\n      const __super__ = (p) => super[p]; // define super accessor function\r\n      yield* __hook__(function* () {\r\n        yield* __hook__('s()', this, [\r\n          'generator',\r\n          [],\r\n          __super__ // use the accessor function\r\n        ], '../gen1.js,A,generator');\r\n        yield* [\r\n          4,\r\n          5,\r\n          6\r\n        ];\r\n      }, this, arguments, '../gen1.js,A,generator');\r\n    }\r\n  }\r\n}\r\n```"}}
{"actor":{"display_login":"t2ym"}}