wrote more of the compressor and added some tests

This commit is contained in:
Mihai Bazon
2012-08-22 15:21:58 +03:00
parent f53e139d3c
commit 159a6f048c
10 changed files with 497 additions and 19 deletions

View File

@@ -0,0 +1,53 @@
dead_code_1: {
options = {
dead_code: true
};
input: {
function f() {
a();
b();
x = 10;
return;
if (x) {
y();
}
}
}
expect: {
function f() {
a();
b();
x = 10;
return;
}
}
}
dead_code_2_should_warn: {
options = {
dead_code: true
};
input: {
function f() {
g();
x = 10;
throw "foo";
// completely discarding the `if` would introduce some
// bugs. UglifyJS v1 doesn't deal with this issue.
if (x) {
y();
var x;
function g(){};
}
}
}
expect: {
function f() {
g();
x = 10;
throw "foo";
var x;
function g(){};
}
}
}