Merge branch 'master' into fix-harmony
This commit is contained in:
@@ -71,7 +71,8 @@ function mangle_properties(ast, options) {
|
||||
reserved : null,
|
||||
cache : null,
|
||||
only_cache : false,
|
||||
regex : null
|
||||
regex : null,
|
||||
ignore_quoted : false
|
||||
});
|
||||
|
||||
var reserved = options.reserved;
|
||||
@@ -87,6 +88,7 @@ function mangle_properties(ast, options) {
|
||||
}
|
||||
|
||||
var regex = options.regex;
|
||||
var ignore_quoted = options.ignore_quoted;
|
||||
|
||||
var names_to_mangle = [];
|
||||
var unmangleable = [];
|
||||
@@ -94,7 +96,8 @@ function mangle_properties(ast, options) {
|
||||
// step 1: find candidates to mangle
|
||||
ast.walk(new TreeWalker(function(node){
|
||||
if (node instanceof AST_ObjectKeyVal) {
|
||||
add(node.key);
|
||||
if (!(ignore_quoted && node.quote))
|
||||
add(node.key);
|
||||
}
|
||||
else if (node instanceof AST_ObjectProperty) {
|
||||
// setter or getter, since KeyVal is handled above
|
||||
@@ -107,7 +110,8 @@ function mangle_properties(ast, options) {
|
||||
}
|
||||
else if (node instanceof AST_Sub) {
|
||||
if (this.parent() instanceof AST_Assign) {
|
||||
addStrings(node.property);
|
||||
if (!ignore_quoted)
|
||||
addStrings(node.property);
|
||||
}
|
||||
}
|
||||
else if (node instanceof AST_ConciseMethod) {
|
||||
@@ -118,7 +122,8 @@ function mangle_properties(ast, options) {
|
||||
// step 2: transform the tree, renaming properties
|
||||
return ast.transform(new TreeTransformer(function(node){
|
||||
if (node instanceof AST_ObjectKeyVal) {
|
||||
node.key = mangle(node.key);
|
||||
if (!(ignore_quoted && node.quote))
|
||||
node.key = mangle(node.key);
|
||||
}
|
||||
else if (node instanceof AST_ObjectProperty) {
|
||||
// setter or getter
|
||||
@@ -128,7 +133,8 @@ function mangle_properties(ast, options) {
|
||||
node.property = mangle(node.property);
|
||||
}
|
||||
else if (node instanceof AST_Sub) {
|
||||
node.property = mangleStrings(node.property);
|
||||
if (!ignore_quoted)
|
||||
node.property = mangleStrings(node.property);
|
||||
}
|
||||
else if (node instanceof AST_ConciseMethod) {
|
||||
if (should_mangle(node.name.name)) {
|
||||
|
||||
Reference in New Issue
Block a user