option to exclude certain names from mangling
This commit is contained in:
12
lib/scope.js
12
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);
|
||||
|
||||
Reference in New Issue
Block a user