restringer
restringer copied to clipboard
Respect order in unwrapIIFEs
Fix for https://github.com/PerimeterX/restringer/issues/102
Although the mentioned bug seems fixed by this, there is a larger problem, consider:
var a = 0;
var x= 1;
(x=2) + function(){
a=3
}();
console.log(x)
In general, the IIFE might be part of a larger expression that still needs executing. The safe option would be to only consider IIFE's that are directly part of the body, or a single assignment. This would however ignore cases like
void !function(){
... some code with outside effects ...
}