aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 74e2c6fc..a34272ca 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1610,7 +1610,12 @@ merge(Compressor.prototype, {
if (parent.condition !== node) return node;
return find_stop_value(parent, level + 1);
}
- if (parent instanceof AST_ObjectKeyVal) return find_stop_value(scanner.parent(level + 1), level + 2);
+ if (parent instanceof AST_ObjectKeyVal) {
+ var obj = scanner.parent(level + 1);
+ return all(obj.properties, function(prop) {
+ return prop instanceof AST_ObjectKeyVal;
+ }) ? find_stop_value(obj, level + 2) : obj;
+ }
if (parent instanceof AST_PropAccess) return find_stop_value(parent, level + 1);
if (parent instanceof AST_Sequence) {
return (parent.tail_node() === node ? find_stop_value : find_stop_unused)(parent, level + 1);
@@ -1651,7 +1656,12 @@ merge(Compressor.prototype, {
if (parent instanceof AST_Exit) return find_stop_unused(parent, level + 1);
if (parent instanceof AST_If) return find_stop_unused(parent, level + 1);
if (parent instanceof AST_IterationStatement) return node;
- if (parent instanceof AST_ObjectKeyVal) return find_stop_unused(scanner.parent(level + 1), level + 2);
+ if (parent instanceof AST_ObjectKeyVal) {
+ var obj = scanner.parent(level + 1);
+ return all(obj.properties, function(prop) {
+ return prop instanceof AST_ObjectKeyVal;
+ }) ? find_stop_unused(obj, level + 2) : obj;
+ }
if (parent instanceof AST_PropAccess) {
var exp = parent.expression;
if (exp === node) return find_stop_unused(parent, level + 1);