Emscripten generates code that allows the caller to provide the Wasm module (thorugh Module.instantiateWasm), with a fallback in case .instantiateWasm is not provided. We always define instantiateWasm, so we can hard-code the check and let our dead code elimination logic remove the unused fallback. This commit also improved the dead code elimination logic so that if a function declaration becomes unused as a result of removing dead code, the function itself is removed.
36 lines
288 B
JavaScript
36 lines
288 B
JavaScript
if ('test') {
|
|
"1";
|
|
}
|
|
if (true) {
|
|
"1";
|
|
}
|
|
if (true) {
|
|
"1";
|
|
} else {
|
|
"2";
|
|
}
|
|
if (false) {
|
|
"1";
|
|
}
|
|
if (false) {
|
|
"1";
|
|
} else {
|
|
"2";
|
|
}
|
|
if (true && false) {
|
|
"1";
|
|
}
|
|
if (true && false || '1') {
|
|
"1";
|
|
}
|
|
|
|
function f1() {
|
|
if (true) {
|
|
"1";
|
|
}
|
|
if (false) {
|
|
"2";
|
|
}
|
|
}
|
|
f1();
|