[Pkg-javascript-commits] [uglifyjs] 240/491: fix `unsafe` evaluation of objects (#2388)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:40 UTC 2018


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit 4ae1fb3ed8380d06220fd242037bd277fc21c17d
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Sun Oct 22 04:19:40 2017 +0800

    fix `unsafe` evaluation of objects (#2388)
---
 lib/compress.js             |  1 +
 test/compress/properties.js | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/lib/compress.js b/lib/compress.js
index c7e0863..cef5d75 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4492,6 +4492,7 @@ merge(Compressor.prototype, {
         if (def) {
             return def.optimize(compressor);
         }
+        if (is_lhs(self, compressor.parent())) return self;
         if (compressor.option("unsafe") && self.expression instanceof AST_Object) {
             var values = self.expression.properties;
             for (var i = values.length; --i >= 0;) {
diff --git a/test/compress/properties.js b/test/compress/properties.js
index c2c43f6..c8a8569 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -804,3 +804,21 @@ issue_2256: {
         g.keep = g.g;
     }
 }
+
+lhs_prop: {
+    options = {
+        evaluate: true,
+        unsafe: true,
+    }
+    input: {
+        console.log(++{
+            a: 1
+        }.a);
+    }
+    expect: {
+        console.log(++{
+            a: 1
+        }.a);
+    }
+    expect_stdout: "2"
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list