more constant folding (for names defined with const)
This commit is contained in:
@@ -582,6 +582,16 @@ merge(Compressor.prototype, {
|
|||||||
? ev(this.consequent)
|
? ev(this.consequent)
|
||||||
: ev(this.alternative);
|
: ev(this.alternative);
|
||||||
});
|
});
|
||||||
|
def(AST_SymbolRef, function(){
|
||||||
|
var d = this.definition();
|
||||||
|
if (d && d.constant) {
|
||||||
|
var orig = d.orig[0];
|
||||||
|
if (orig) orig = orig.init[0];
|
||||||
|
orig = orig && orig.value;
|
||||||
|
if (orig) return ev(orig);
|
||||||
|
}
|
||||||
|
throw def;
|
||||||
|
});
|
||||||
})(function(node, func){
|
})(function(node, func){
|
||||||
node.DEFMETHOD("_eval", func);
|
node.DEFMETHOD("_eval", func);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user