Skip to content

Commit

Permalink
minor clean-ups to evaluate (#2197)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl authored Jul 3, 2017
1 parent af0262b commit 5f046c7
Showing 1 changed file with 27 additions and 30 deletions.
57 changes: 27 additions & 30 deletions lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -1692,12 +1692,9 @@ merge(Compressor.prototype, {
});
def(AST_SymbolRef, function(compressor){
if (!compressor.option("reduce_vars")) return this;
this._eval = return_this;
var fixed = this.fixed_value();
if (!fixed) {
delete this._eval;
return this;
}
if (!fixed) return this;
this._eval = return_this;
var value = ev(fixed, compressor);
if (value === fixed) {
delete this._eval;
Expand Down Expand Up @@ -1729,41 +1726,41 @@ merge(Compressor.prototype, {
return this;
});
var object_fns = [
'constructor',
'toString',
'valueOf',
"constructor",
"toString",
"valueOf",
];
var native_fns = {
Array: makePredicate([
'indexOf',
'join',
'lastIndexOf',
'slice',
"indexOf",
"join",
"lastIndexOf",
"slice",
].concat(object_fns)),
Boolean: makePredicate(object_fns),
Number: makePredicate([
'toExponential',
'toFixed',
'toPrecision',
"toExponential",
"toFixed",
"toPrecision",
].concat(object_fns)),
RegExp: makePredicate([
'test',
"test",
].concat(object_fns)),
String: makePredicate([
'charAt',
'charCodeAt',
'concat',
'indexOf',
'italics',
'lastIndexOf',
'match',
'replace',
'search',
'slice',
'split',
'substr',
'substring',
'trim',
"charAt",
"charCodeAt",
"concat",
"indexOf",
"italics",
"lastIndexOf",
"match",
"replace",
"search",
"slice",
"split",
"substr",
"substring",
"trim",
].concat(object_fns)),
};
def(AST_Call, function(compressor){
Expand Down

0 comments on commit 5f046c7

Please sign in to comment.