aboutsummaryrefslogtreecommitdiff
path: root/lib/propmangle.js
AgeCommit message (Expand)Author
2015-04-22If name_cache is specified, do rename cached properties...(even if --mangle-props is not there) Mihai Bazon
2015-04-10Use the `before` visitor in mangle props...(works around a bug in our tree walker which, while cloning nodes, breaks references between labeled statements and break/continue labels) Mihai Bazon
2015-03-16Fix prop mangling...Even if not “defined”, do mangle if name exists in the cache. Mihai Bazon
2015-03-14Add property name mangler...We only touch properties that are present in an object literal, or which are assigned to. Example: x = { foo: 1 }; x.bar = 2; x["baz"] = 3; x[cond ? "qwe" : "asd"] = 4; console.log(x.stuff); The names "foo", "bar", "baz", "qwe" and "asd" will be mangled, and the resulting mangled names will be used for the same properties throughout the code. The "stuff" will not be, since it's just referenced but never assigned to. This *will* break most of the code out there, but could work on carefully written code: do not use eval, do not define methods or properties by walking an array of names, etc. Also, a comprehensive list of exclusions needs to be passed, to avoid mangling properties that are standard in JavaScript, DOM, used in external libraries etc. Mihai Bazon