Closed Conduitry closed 7 years ago
Something I bumped into while I was narrowing down this error case -
for (let x of a);
This by itself seems to get minified fine. With check: true
, it says it generated invalid JS, but it looks valid to me.
Actually,
for (let x;;) {}
for (let x;;) {}
minifies as
for(let x;;){}for(x;;){}
which is no good.
I was poking around a bit and I saw a createdScope
value on various elements that some code is trying to use, but I don't actually see where it's set. If that's always undefined (falsy) that feels like it could be related to this behavior.
Thanks – fixed in #37. The short answer for why mysterious properties like createdScope
are in the codebase is that I forked it from Bublé several months ago as an experiment for a talk, then left it to gather dust until a few days ago. I'm still trying to figure out my way around it tbh!
:+1: The issues with for
and for-of
loops that I was seeing look fixed in your PR.
I took another look at what I mentioned in my second comment here - there does actually seem to be a code generation error here. I'll open another ticket for that, but it really is a bit of an edge case.
x is already declared
If one of the loops is a regular
for
loop, the exception is still thrown. If both are regularfor
loops, everything works fine.