mangle Object.defineProperty() (#3059)

fixes #869
This commit is contained in:
Alex Lam S.L
2018-04-06 17:10:36 +08:00
committed by GitHub
parent 923deeff35
commit db49daf365
2 changed files with 66 additions and 0 deletions

View File

@@ -150,6 +150,10 @@ function mangle_properties(ast, options) {
else if (node instanceof AST_Sub) {
addStrings(node.property, add);
}
else if (node instanceof AST_Call
&& node.expression.print_to_string() == "Object.defineProperty") {
addStrings(node.args[1], add);
}
}));
// step 2: transform the tree, renaming properties
@@ -167,6 +171,10 @@ function mangle_properties(ast, options) {
else if (!options.keep_quoted && node instanceof AST_Sub) {
node.property = mangleStrings(node.property);
}
else if (node instanceof AST_Call
&& node.expression.print_to_string() == "Object.defineProperty") {
node.args[1] = mangleStrings(node.args[1]);
}
}));
// only function declarations after this line