Closed jbt closed 7 years ago
I added some test cases around logical expressions in a new logical-expressions.js
. Lots of different cases so apologies if it's overkill.
My best guess why this wasn't failing before was because the true || false
test case was creating an intermediate emptystring, but subsequently the Literal
minification of true
to !0
was reinstating the lefthand expression again.
This is extremely helpful, thank you very much!
This fixes #54 - previously code was being removed from the beginning of the left expression, whereas the whole lefthand expression should be kept.
Happy to put in test(s) too, just wasn't entirely sure which file to put it/them in. As it turns out it was also failing for any logical-or expression where the lefthand side was known-truthy (e.g.
x = 1 || 0; 1
was producingx=,1
)