[Pkg-javascript-commits] [uglifyjs] 06/11: If name_cache is specified, do rename cached properties
Jonas Smedegaard
dr at jones.dk
Tue May 19 00:02:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag v2.4.21
in repository uglifyjs.
commit 7b22f2031fdbb778dac1968449b950290f6d9216
Author: Mihai Bazon <mihai.bazon at gmail.com>
Date: Wed Apr 22 17:34:49 2015 +0300
If name_cache is specified, do rename cached properties
(even if --mangle-props is not there)
---
bin/uglifyjs | 7 ++++---
lib/propmangle.js | 6 +++++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/bin/uglifyjs b/bin/uglifyjs
index df7b783..67db297 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -372,12 +372,13 @@ async.eachLimit(files, 1, function (file, cb) {
TOPLEVEL = TOPLEVEL.wrap_enclose(arg_parameter_list);
}
- if (ARGS.mangle_props) (function(){
+ if (ARGS.mangle_props || ARGS.name_cache) (function(){
var reserved = RESERVED ? RESERVED.props : null;
var cache = readNameCache("props");
TOPLEVEL = UglifyJS.mangle_properties(TOPLEVEL, {
- reserved: reserved,
- cache: cache
+ reserved : reserved,
+ cache : cache,
+ only_cache : !ARGS.mangle_props
});
writeNameCache("props", cache);
})();
diff --git a/lib/propmangle.js b/lib/propmangle.js
index 46fb752..8f291d6 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;
--
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