Open jimdebeer opened 6 years ago
Slightly simpler testcase:
function a() {
return;
foo();
let c = bar();
baz(c);
}
//With deadcode:
"use strict";function a(){var c=bar()}
The return statement and all code after it is removed, except for the variable declaration which fails to be removed when it should.
Opposite testcase:
function a() {
q = 42;
++q;
return;
{
var q;
}
}
//With deadcode:
"use strict";function a(){q=42;++q}
The variable declaration here fails to be preserved, even though it should be in this case.
Hi I'm going to try to look at this. Thanks!
Describe the bug
A strange edge case code does not get eliminated correctly.
To Reproduce
Minimal code to reproduce the bug
Actual Output
If there is no Error thrown,
Expected Output
Configuration
How are you using babel-minify?
babel dependency
babel version :
7.0.0-beta.3
Used stand alone using the Node Api + babel-core
Additional context
See it in action in the babel-repl
Encountered this construction here
Tried to recreate it as minimal as possible using only babel-core and the dead-code plugin