aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-10-27 14:28:09 +0800
committerGitHub <noreply@github.com>2017-10-27 14:28:09 +0800
commit31f82091930b39ebb5d9358951c39ae20cf8057e (patch)
tree74afe832a85e92e515835e9bfc5e86aa50ad1699 /lib
parent9b0f86f5a136f57dece826c3ec9b632a0d0cb53a (diff)
downloadtracifyjs-31f82091930b39ebb5d9358951c39ae20cf8057e.tar.gz
tracifyjs-31f82091930b39ebb5d9358951c39ae20cf8057e.zip
remove dead code (#2405)
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js29
1 files changed, 0 insertions, 29 deletions
diff --git a/lib/compress.js b/lib/compress.js
index a2dd243f..4817ec5f 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -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));
});