google / google/closure-compiler
ES6 code generation triggers Safari 10.x bug
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
```js
function foo(e) {
console.log(e);
for (let e of [1, 2, 3]) // Cannot declare a let variable twice: 'e'.
console.log(e);
};
```
This code example throws an exception in Safari 10.x (fixed in Safari 11). Because Closure Compiler will happily generate such code (after renaming, I didn't reuse variable names in my input code), it should provide an option to provide Safari10-compatible code (thus `for (let f of ...)`). UglifyJS went through the same thing and ended up with a Safari10 option, see https://github.com/mishoo/UglifyJS2/issues/1753.
JavaScriptCore bug here: https://bugs.webkit.org/show_bug.cgi?id=171041
Contributor guide
Assessment
This issue has not been assessed yet.