Merge branch 'master' into harmony

This commit is contained in:
Richard van Velzen
2015-08-21 11:58:35 +02:00
7 changed files with 84 additions and 15 deletions

View File

@@ -2308,7 +2308,15 @@ merge(Compressor.prototype, {
});
OPT(AST_SymbolRef, function(self, compressor){
if (self.undeclared()) {
function isLHS(symbol, parent) {
return (
parent instanceof AST_Binary &&
parent.operator === '=' &&
parent.left === symbol
);
}
if (self.undeclared() && !isLHS(self, compressor.parent())) {
var defines = compressor.option("global_defs");
if (defines && defines.hasOwnProperty(self.name)) {
return make_node_from_constant(compressor, defines[self.name], self);