aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2019-04-29 08:55:46 +0800
committerGitHub <noreply@github.com>2019-04-29 08:55:46 +0800
commit413bbe0480d28d18833fbc3ebdb68fa74138d758 (patch)
tree81fd4736065aa6a8d319568a05959d3f314aa7f6 /lib/compress.js
parent34075fc4c44eaf3369ffa76a1c7fa4f8281456bd (diff)
downloadtracifyjs-413bbe0480d28d18833fbc3ebdb68fa74138d758.tar.gz
tracifyjs-413bbe0480d28d18833fbc3ebdb68fa74138d758.zip
fix corner case in `evaluate` (#3388)
fixes #3387
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/compress.js b/lib/compress.js
index a7585a60..1a1b64f9 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2553,9 +2553,6 @@ merge(Compressor.prototype, {
return this.tail_node().is_string(compressor);
});
def(AST_String, return_true);
- def(AST_Sub, function(compressor) {
- return this.expression.is_string(compressor) && this.property instanceof AST_Number;
- });
def(AST_SymbolRef, function(compressor) {
var fixed = this.fixed_value();
if (!fixed) return false;
@@ -2994,7 +2991,8 @@ merge(Compressor.prototype, {
val = global_objs[exp.name];
} else {
val = exp._eval(compressor, cached, depth + 1);
- if (!val || val === exp || !HOP(val, key)) return this;
+ if (!val || val === exp) return this;
+ if (typeof val == "object" && !HOP(val, key)) return this;
if (typeof val == "function") switch (key) {
case "name":
return val.node.name ? val.node.name.name : "";