Invalid yield statement minification
IJMacD opened this issue · 1 comments
IJMacD commented
test.js:
function *gen () {
if (Math.random() > 0.5) {
yield 10;
}
}
console.log([...gen()]);
Minify output:
function a(){Math.random()>0.5&&yield 10}console.log([...a()]);
Minify produces a short circuit expression which is invalid with statements such as yield
.
As a counter example Minify does the correct thing with return
statements.
test.js
function gen () {
if (Math.random() > 0.5) {
return 10;
}
}
console.log(gen());
Minify output:
function a(){if(Math.random()>0.5)return 10}console.log(a());
coderaiser commented
Thank you! Just fixed, please re-install Minify and try again, is it works for you?