Optimize unmodified variables
This commit is contained in:
committed by
Richard van Velzen
parent
0111497fc9
commit
4761d07e0b
@@ -67,6 +67,7 @@ function Compressor(options, false_by_default) {
|
||||
if_return : !false_by_default,
|
||||
join_vars : !false_by_default,
|
||||
collapse_vars : false,
|
||||
reduce_vars : false,
|
||||
cascade : !false_by_default,
|
||||
side_effects : !false_by_default,
|
||||
pure_getters : false,
|
||||
@@ -1107,7 +1108,7 @@ merge(Compressor.prototype, {
|
||||
this._evaluating = true;
|
||||
try {
|
||||
var d = this.definition();
|
||||
if (d && d.constant && d.init) {
|
||||
if (d && (d.constant || compressor.option("reduce_vars") && !d.modified) && d.init) {
|
||||
return ev(d.init, compressor);
|
||||
}
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user