Closed loilo closed 7 years ago
I couldn't even find a proper descriptive title for this.
So, trying to squash minified AdapterJS revealed another problem.
Boiled down to the essence, the following code generates invalid JavaScript:
function fn () { if ( any_condition ) global_variable = true; else var local_variable = true; }
The invalid output is the following:
function fn(){any_condition&&(global_variable=!0;)} // invalid semicolon ^
This will only happen (list may not be exhaustive) if:
if
else
var
let
const
{ ... }
I couldn't even find a proper descriptive title for this.
So, trying to squash minified AdapterJS revealed another problem.
Boiled down to the essence, the following code generates invalid JavaScript:
The invalid output is the following:
This will only happen (list may not be exhaustive) if:
if
block is global (also works with a property of a global object).if
block ends with a semi-colon.else
block is present. Curly braces are optional.else
block only contains any of the following:var
,let
,const
) is inside theelse
block.if
/else
blocks that only contain things from this list (recursion, yay!){ ... }
with any content