From 65922fcbb260cc725e841cd69374f80aa7f95739 Mon Sep 17 00:00:00 2001 From: "Ashley (Scirra)" Date: Fri, 7 Oct 2016 12:38:48 +0100 Subject: [PATCH] Address style nits Also rename `debug_cache_name` to the more accurate `debug_name_suffix`. --- lib/propmangle.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/propmangle.js b/lib/propmangle.js index 78bb9a63..0a84b83b 100644 --- a/lib/propmangle.js +++ b/lib/propmangle.js @@ -102,12 +102,10 @@ function mangle_properties(ast, options) { var regex = options.regex; var ignore_quoted = options.ignore_quoted; - // note debug is either false (disabled), or a string of the debug cache name to use (enabled). + // note debug is either false (disabled), or a string of the debug suffix to use (enabled). // note debug may be enabled as an empty string, which is falsey. var debug = (options.debug !== false); - var debug_cache_name; - if (debug) - debug_cache_name = options.debug; + var debug_name_suffix = debug ? options.debug : null; var names_to_mangle = []; var unmangleable = []; @@ -212,10 +210,11 @@ function mangle_properties(ast, options) { if (!mangled) { if (debug) { // debug mode: use a prefix and suffix to preserve readability, e.g. o.foo -> o._$foo$NNN_. - var debug_mangled = "_$" + name + "$" + debug_cache_name + "_"; + var debug_mangled = "_$" + name + "$" + debug_name_suffix + "_"; - if (can_mangle(debug_mangled) && !(ignore_quoted && debug_mangled in ignored)) + if (can_mangle(debug_mangled) && !(ignore_quoted && debug_mangled in ignored)) { mangled = debug_mangled; + } } // either debug mode is off, or it is on and we could not use the mangled name