Don't drop unused setter argument.

Fix #257
This commit is contained in:
Mihai Bazon
2013-08-07 12:04:58 +03:00
parent 4aa4b3e694
commit 4c4dc2137c
2 changed files with 25 additions and 1 deletions

View File

@@ -948,7 +948,7 @@ merge(Compressor.prototype, {
// pass 3: we should drop declarations not in_use // pass 3: we should drop declarations not in_use
var tt = new TreeTransformer( var tt = new TreeTransformer(
function before(node, descend, in_list) { function before(node, descend, in_list) {
if (node instanceof AST_Lambda) { if (node instanceof AST_Lambda && !(node instanceof AST_Accessor)) {
for (var a = node.argnames, i = a.length; --i >= 0;) { for (var a = node.argnames, i = a.length; --i >= 0;) {
var sym = a[i]; var sym = a[i];
if (sym.unreferenced()) { if (sym.unreferenced()) {

View File

@@ -95,3 +95,27 @@ unused_circular_references_3: {
} }
} }
} }
unused_keep_setter_arg: {
options = { unused: true };
input: {
var x = {
_foo: null,
set foo(val) {
},
get foo() {
return this._foo;
}
}
}
expect: {
var x = {
_foo: null,
set foo(val) {
},
get foo() {
return this._foo;
}
}
}
}