[Pkg-javascript-commits] [uglifyjs] 241/491: fix `unsafe` evaluation of `AST_Sub` (#2389)
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 516eaef50c66aede72d3478a5653ae8651806258
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date: Sun Oct 22 13:14:15 2017 +0800
fix `unsafe` evaluation of `AST_Sub` (#2389)
---
lib/compress.js | 1 +
test/compress/properties.js | 21 ++++++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/lib/compress.js b/lib/compress.js
index cef5d75..6a40ef2 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4468,6 +4468,7 @@ merge(Compressor.prototype, {
});
}
}
+ if (is_lhs(self, compressor.parent())) return self;
var ev = self.evaluate(compressor);
if (ev !== self) {
ev = make_node_from_constant(ev, self).optimize(compressor);
diff --git a/test/compress/properties.js b/test/compress/properties.js
index c8a8569..45f870d 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -805,7 +805,7 @@ issue_2256: {
}
}
-lhs_prop: {
+lhs_prop_1: {
options = {
evaluate: true,
unsafe: true,
@@ -822,3 +822,22 @@ lhs_prop: {
}
expect_stdout: "2"
}
+
+lhs_prop_2: {
+ options = {
+ evaluate: true,
+ inline: true,
+ reduce_vars: true,
+ side_effects: true,
+ unsafe: true,
+ unused: true,
+ }
+ input: {
+ (function(a) {
+ a[2] = "g";
+ })("abc");
+ }
+ expect: {
+ "abc"[2] = "g";
+ }
+}
--
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