google / google/closure-compiler
Ugly Handling of ES6 Generators
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
In a nutshell, see this [JSCompiler Debugger output](https://closure-compiler-debugger.appspot.com/#input0%3Dconst%2520ns%2520%253D%2520%257B%257D%250A%250A%252F**%2520%2540constructor%2520*%252F%250Ans.Iterator%2520%253D%2520function*%28iterable%29%2520%257B%250A%2520%2520for%2520%28value%2520of%2520iterable%29%2520%257B%250A%2520%2520%2520%2520yield%2520value%250A%2520%2520%257D%250A%257D%250A%250A%252F**%2520%2540type%2520%257Bns.Iterator%257D%2520*%252F%250Aconst%2520a%2520%253D%2520new%2520ns.Iterator%28%255B1%252C2%252C3%255D%29%250A%26input1%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1)
A few issues. First of all the generated JS is damn ugly, someone dropped a slow-as-snails `switch` statement in there! Secondly the generator isn't being treated as a constructor despite the annotation being there and the use of the `new` keyword.
The latter might not have been implemented in Closure yet but I thought I would highlight it :)
Contributor guide
Assessment
This issue has not been assessed yet.