properly drop mutually-referring declarations that are not otherwise

referenced and have no side effects
This commit is contained in:
Mihai Bazon
2012-09-23 12:47:34 +03:00
parent 76d88b59dc
commit a83b28503f
5 changed files with 137 additions and 67 deletions

View File

@@ -68,14 +68,17 @@ TreeTransformer.prototype = {
node.DEFMETHOD("transform", function(tw, in_list){
var x, y;
tw.push(this);
x = tw.before(this, function(){
descend(x, tw);
}, in_list);
x = tw.before(this, descend, in_list);
if (x === undefined) {
x = this.clone();
descend(x, tw);
y = tw.after(this, in_list);
if (y !== undefined) x = y;
if (!tw.after) {
x = this;
descend(x, tw);
} else {
x = this.clone();
descend(x, tw);
y = tw.after(this, in_list);
if (y !== undefined) x = y;
}
}
tw.pop();
return x;