diff options
author | kzc <zaxxon2011@gmail.com> | 2016-07-31 02:35:14 -0400 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2016-08-14 21:51:25 +0200 |
commit | de619ae5a62472a76b0bfaa23d8e0b3068472196 (patch) | |
tree | b2e04ba43a47de40dbfbb39bc35347341e3ac432 /test/compress/properties.js | |
parent | 86859f6d7e9e738ccf09a83a28962c9bad8e959f (diff) | |
download | tracifyjs-de619ae5a62472a76b0bfaa23d8e0b3068472196.tar.gz tracifyjs-de619ae5a62472a76b0bfaa23d8e0b3068472196.zip |
Fix --mangle-props and --mangle-props=unquoted
Fixes: #1247
Fix --mangle-props and --name-cache inconsistency.
AST_Dot and AST_Sub properties are now mangled by --mangle-props
without regard to being used in an assignment statement.
Note: if --mangle-props is used then *all* javascript files used must
be uglified with the same mangle options.
Fix the ignore_quoted=true mangle option, also known as
`--mangle-props=unquoted`. If a given property is quoted anywhere
it will not be mangled in any quoted or non-quoted context.
Diffstat (limited to 'test/compress/properties.js')
-rw-r--r-- | test/compress/properties.js | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/test/compress/properties.js b/test/compress/properties.js index 4aaa92cb..f1680808 100644 --- a/test/compress/properties.js +++ b/test/compress/properties.js @@ -82,15 +82,22 @@ mangle_properties: { a["foo"] = "bar"; a.color = "red"; x = {"bar": 10}; + a.run(x.bar, a.foo); + a['run']({color: "blue", foo: "baz"}); } expect: { a["a"] = "bar"; a.b = "red"; x = {c: 10}; + a.d(x.c, a.a); + a['d']({b: "blue", a: "baz"}); } } mangle_unquoted_properties: { + options = { + properties: false + } mangle_props = { ignore_quoted: true } @@ -100,27 +107,37 @@ mangle_unquoted_properties: { keep_quoted_props: true, } input: { + a.top = 1; function f1() { a["foo"] = "bar"; a.color = "red"; - x = {"bar": 10}; + a.stuff = 2; + x = {"bar": 10, size: 7}; + a.size = 9; } function f2() { a.foo = "bar"; a['color'] = "red"; - x = {bar: 10}; + x = {bar: 10, size: 7}; + a.size = 9; + a.stuff = 3; } } expect: { + a.a = 1; function f1() { a["foo"] = "bar"; - a.a = "red"; - x = {"bar": 10}; + a.color = "red"; + a.b = 2; + x = {"bar": 10, c: 7}; + a.c = 9; } function f2() { - a.b = "bar"; + a.foo = "bar"; a['color'] = "red"; - x = {c: 10}; + x = {bar: 10, c: 7}; + a.c = 9; + a.b = 3; } } } |