disable hoist_vars by default and change comparations to comparisons
This commit is contained in:
@@ -54,13 +54,13 @@ function Compressor(options, false_by_default) {
|
|||||||
drop_debugger : !false_by_default,
|
drop_debugger : !false_by_default,
|
||||||
unsafe : !false_by_default,
|
unsafe : !false_by_default,
|
||||||
conditionals : !false_by_default,
|
conditionals : !false_by_default,
|
||||||
comparations : !false_by_default,
|
comparisons : !false_by_default,
|
||||||
evaluate : !false_by_default,
|
evaluate : !false_by_default,
|
||||||
booleans : !false_by_default,
|
booleans : !false_by_default,
|
||||||
loops : !false_by_default,
|
loops : !false_by_default,
|
||||||
unused : !false_by_default,
|
unused : !false_by_default,
|
||||||
hoist_funs : !false_by_default,
|
hoist_funs : !false_by_default,
|
||||||
hoist_vars : !false_by_default,
|
hoist_vars : false,
|
||||||
if_return : !false_by_default,
|
if_return : !false_by_default,
|
||||||
join_vars : !false_by_default,
|
join_vars : !false_by_default,
|
||||||
cascade : !false_by_default,
|
cascade : !false_by_default,
|
||||||
@@ -632,7 +632,7 @@ merge(Compressor.prototype, {
|
|||||||
});
|
});
|
||||||
def(AST_Binary, function(compressor){
|
def(AST_Binary, function(compressor){
|
||||||
var self = this.clone(), op = this.operator;
|
var self = this.clone(), op = this.operator;
|
||||||
if (compressor.option("comparations") && compressor.option("unsafe")) {
|
if (compressor.option("comparisons") && compressor.option("unsafe")) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case "<=" : self.operator = ">" ; return self;
|
case "<=" : self.operator = ">" ; return self;
|
||||||
case "<" : self.operator = ">=" ; return self;
|
case "<" : self.operator = ">=" ; return self;
|
||||||
@@ -1337,7 +1337,7 @@ merge(Compressor.prototype, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
OPT(AST_Binary, function(self, compressor){
|
OPT(AST_Binary, function(self, compressor){
|
||||||
if (compressor.option("comparations")) switch (self.operator) {
|
if (compressor.option("comparisons")) switch (self.operator) {
|
||||||
case "===":
|
case "===":
|
||||||
case "!==":
|
case "!==":
|
||||||
if ((self.left.is_string() && self.right.is_string()) ||
|
if ((self.left.is_string() && self.right.is_string()) ||
|
||||||
@@ -1415,7 +1415,7 @@ merge(Compressor.prototype, {
|
|||||||
if (best_of(exp[0], self) !== self)
|
if (best_of(exp[0], self) !== self)
|
||||||
return exp[0];
|
return exp[0];
|
||||||
}
|
}
|
||||||
if (compressor.option("comparations")) {
|
if (compressor.option("comparisons")) {
|
||||||
if (!(compressor.parent() instanceof AST_Binary)) {
|
if (!(compressor.parent() instanceof AST_Binary)) {
|
||||||
var negated = make_node(AST_UnaryPrefix, self, {
|
var negated = make_node(AST_UnaryPrefix, self, {
|
||||||
operator: "!",
|
operator: "!",
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ ifs_5: {
|
|||||||
options = {
|
options = {
|
||||||
if_return: true,
|
if_return: true,
|
||||||
conditionals: true,
|
conditionals: true,
|
||||||
comparations: true,
|
comparisons: true,
|
||||||
};
|
};
|
||||||
input: {
|
input: {
|
||||||
function f() {
|
function f() {
|
||||||
|
|||||||
Reference in New Issue
Block a user