From 2a9989dd18c01081c486fe9089e3bb64079c773b Mon Sep 17 00:00:00 2001 From: "Ashley (Scirra)" Date: Thu, 27 Oct 2016 11:23:04 -0400 Subject: Add --mangle-props-debug and fix --mangle-props=unquoted collision Patch by @AshleyScirra Based on: PR #1316 Renamed the CLI debug option to --mangle-props-debug Fixes: #1321 name collision in --mangle-props=unquoted --- test/compress/issue-1321.js | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 test/compress/issue-1321.js (limited to 'test/compress/issue-1321.js') diff --git a/test/compress/issue-1321.js b/test/compress/issue-1321.js new file mode 100644 index 00000000..2b6f17bf --- /dev/null +++ b/test/compress/issue-1321.js @@ -0,0 +1,54 @@ +issue_1321_no_debug: { + mangle_props = { + ignore_quoted: true + } + input: { + var x = {}; + x.foo = 1; + x["a"] = 2 * x.foo; + console.log(x.foo, x["a"]); + } + expect: { + var x = {}; + x.b = 1; + x["a"] = 2 * x.b; + console.log(x.b, x["a"]); + } +} + +issue_1321_debug: { + mangle_props = { + ignore_quoted: true, + debug: "" + } + input: { + var x = {}; + x.foo = 1; + x["_$foo$_"] = 2 * x.foo; + console.log(x.foo, x["_$foo$_"]); + } + expect: { + var x = {}; + x.a = 1; + x["_$foo$_"] = 2 * x.a; + console.log(x.a, x["_$foo$_"]); + } +} + +issue_1321_with_quoted: { + mangle_props = { + ignore_quoted: false + } + input: { + var x = {}; + x.foo = 1; + x["a"] = 2 * x.foo; + console.log(x.foo, x["a"]); + } + expect: { + var x = {}; + x.a = 1; + x["b"] = 2 * x.a; + console.log(x.a, x["b"]); + } +} -- cgit v1.2.3