aboutsummaryrefslogtreecommitdiff
path: root/lib/propmangle.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2015-04-22 17:34:49 +0300
committerMihai Bazon <mihai.bazon@gmail.com>2015-04-22 17:34:49 +0300
commit7b22f2031fdbb778dac1968449b950290f6d9216 (patch)
tree9348e48912b5905bb7dba239307d073e8afd21a7 /lib/propmangle.js
parent3b14582d6b8a93e6f459d71f630a67b489e47dd0 (diff)
downloadtracifyjs-7b22f2031fdbb778dac1968449b950290f6d9216.tar.gz
tracifyjs-7b22f2031fdbb778dac1968449b950290f6d9216.zip
If name_cache is specified, do rename cached properties
(even if --mangle-props is not there)
Diffstat (limited to 'lib/propmangle.js')
-rw-r--r--lib/propmangle.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/propmangle.js b/lib/propmangle.js
index 46fb7521..8f291d64 100644
--- a/lib/propmangle.js
+++ b/lib/propmangle.js
@@ -63,7 +63,8 @@ function find_builtins() {
function mangle_properties(ast, options) {
options = defaults(options, {
reserved : null,
- cache : null
+ cache : null,
+ only_cache : false
});
var reserved = options.reserved;
@@ -139,6 +140,9 @@ function mangle_properties(ast, options) {
// only function declarations after this line
function can_mangle(name) {
+ if (options.only_cache) {
+ return cache.props.has(name);
+ }
if (reserved.indexOf(name) >= 0) return false;
if (/^[0-9.]+$/.test(name)) return false;
return true;