fix destructuring bugs in mangle and compress (#1992)
- destructuring mangle - destructuring array default values fixes #1335
This commit is contained in:
@@ -2097,9 +2097,6 @@ merge(Compressor.prototype, {
|
||||
}));
|
||||
}
|
||||
}
|
||||
else if (node.names[i] instanceof AST_Hole) {
|
||||
continue;
|
||||
}
|
||||
else if (node.names[i] instanceof AST_ObjectKeyVal) {
|
||||
if (typeof node.names[i].key === "string") {
|
||||
initializations.add(node.names[i].key, destructuring_value);
|
||||
@@ -2107,7 +2104,14 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
else if (node.names[i] instanceof AST_Symbol) {
|
||||
initializations.add(node.names[i].name, destructuring_value);
|
||||
} else {
|
||||
}
|
||||
else if (node.names[i] instanceof AST_DefaultAssign) {
|
||||
continue;
|
||||
}
|
||||
else if (node.names[i] instanceof AST_Hole) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
throw new Error(string_template("Unknown destructuring element of type: {type}", {
|
||||
type: Object.getPrototypeOf(node.names[i]).TYPE
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user