remove dead code (#2405)
authorAlex Lam S.L <alexlamsl@gmail.com>
Fri, 27 Oct 2017 06:28:09 +0000 (14:28 +0800)
committerGitHub <noreply@github.com>
Fri, 27 Oct 2017 06:28:09 +0000 (14:28 +0800)
lib/compress.js

index a2dd243..4817ec5 100644 (file)
@@ -1647,35 +1647,6 @@ merge(Compressor.prototype, {
                     && unaryPrefix(this.operator);
             }
         });
-        // Obtain the constant value of an expression already known to be constant.
-        // Result only valid iff this.is_constant() is true.
-        AST_Node.DEFMETHOD("constant_value", function(compressor){
-            // Accomodate when option evaluate=false.
-            if (this instanceof AST_Constant && !(this instanceof AST_RegExp)) {
-                return this.value;
-            }
-            // Accomodate the common constant expressions !0 and -1 when option evaluate=false.
-            if (this instanceof AST_UnaryPrefix
-                && this.expression instanceof AST_Constant) switch (this.operator) {
-              case "!":
-                return !this.expression.value;
-              case "~":
-                return ~this.expression.value;
-              case "-":
-                return -this.expression.value;
-              case "+":
-                return +this.expression.value;
-              default:
-                throw new Error(string_template("Cannot evaluate unary expression {value}", {
-                    value: this.print_to_string()
-                }));
-            }
-            var result = this.evaluate(compressor);
-            if (result !== this) {
-                return result;
-            }
-            throw new Error(string_template("Cannot evaluate constant [{file}:{line},{col}]", this.start));
-        });
         def(AST_Statement, function(){
             throw new Error(string_template("Cannot evaluate a statement [{file}:{line},{col}]", this.start));
         });