@@ -150,6 +150,10 @@ function mangle_properties(ast, options) {
|
|||||||
else if (node instanceof AST_Sub) {
|
else if (node instanceof AST_Sub) {
|
||||||
addStrings(node.property, add);
|
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
|
// 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) {
|
else if (!options.keep_quoted && node instanceof AST_Sub) {
|
||||||
node.property = mangleStrings(node.property);
|
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
|
// only function declarations after this line
|
||||||
|
|||||||
@@ -1640,3 +1640,61 @@ issue_2893_2: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_869_1: {
|
||||||
|
mangle = {
|
||||||
|
properties: {
|
||||||
|
reserved: [ "get" ]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var o = { p: "FAIL" };
|
||||||
|
Object.defineProperty(o, "p", {
|
||||||
|
get: function() {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(o.p);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var o = { o: "FAIL" };
|
||||||
|
Object.defineProperty(o, "o", {
|
||||||
|
get: function() {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(o.o);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_869_2: {
|
||||||
|
mangle = {
|
||||||
|
properties: {
|
||||||
|
reserved: [ "get" ]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var o = { p: "FAIL" };
|
||||||
|
Object.defineProperties(o, {
|
||||||
|
p: {
|
||||||
|
get: function() {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(o.p);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var o = { o: "FAIL" };
|
||||||
|
Object.defineProperties(o, {
|
||||||
|
o: {
|
||||||
|
get: function() {
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(o.o);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user