aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-10-02 14:02:33 +0300
committerMihai Bazon <mihai@bazon.net>2012-10-02 14:02:33 +0300
commit36be211e99ec7c65e156499d53f471a1e55a6fd1 (patch)
tree9a0d134c8218da263299963b001912d13ae2c7b3 /lib/scope.js
parentdde5b22b5e99d4a75c8918659b7f73abed436ce2 (diff)
downloadtracifyjs-36be211e99ec7c65e156499d53f471a1e55a6fd1.tar.gz
tracifyjs-36be211e99ec7c65e156499d53f471a1e55a6fd1.zip
option to exclude certain names from mangling
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/scope.js b/lib/scope.js
index 997e6575..db581fce 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -354,7 +354,8 @@ AST_LoopControl.DEFMETHOD("target", function(){
AST_Toplevel.DEFMETHOD("mangle_names", function(options){
options = defaults(options, {
- sort: false
+ sort : false,
+ except : []
});
// We only need to mangle declaration nodes. Special logic wired
// into the code generator will display the mangled name if it's
@@ -376,8 +377,11 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options){
var a = node.variables;
for (var i in a) if (HOP(a, i)) {
var symbol = a[i];
- if (!(is_setget && symbol instanceof AST_SymbolLambda))
- to_mangle.push(symbol);
+ if (!(is_setget && symbol instanceof AST_SymbolLambda)) {
+ if (options.except.indexOf(symbol.name) < 0) {
+ to_mangle.push(symbol);
+ }
+ }
}
return;
}
@@ -385,7 +389,7 @@ AST_Toplevel.DEFMETHOD("mangle_names", function(options){
var name;
do name = base54(++lname); while (!is_identifier(name));
node.mangled_name = name;
- return;
+ return true;
}
});
this.walk(tw);