- Use AST_Destructuring for lhf assignment patterns - Use AST_DefaultAssign for default assignments - Add more checks for lhs expressions - Add lots of testing - Cleanup ast (e.g. remove default property) - Fix #1402 based on a patch from @kzc - Refine spread allowance in array destructring pattern - Add destructuring AST tree checker
35 lines
662 B
JavaScript
35 lines
662 B
JavaScript
|
|
compress_new_function: {
|
|
options = {
|
|
unsafe: true
|
|
}
|
|
input: {
|
|
new Function("aa, bb", 'return aa;');
|
|
}
|
|
expect: {
|
|
Function("a", "b", "return a");
|
|
}
|
|
}
|
|
|
|
compress_new_function_with_destruct: {
|
|
options = {
|
|
unsafe: true,
|
|
ecma: 6
|
|
}
|
|
beautify = {
|
|
ecma: 6
|
|
}
|
|
input: {
|
|
new Function("aa, [bb]", 'return aa;');
|
|
new Function("aa, {bb}", 'return aa;');
|
|
new Function("[[aa]], [{bb}]", 'return aa;');
|
|
}
|
|
expect: {
|
|
Function("a", "[b]", "return a");
|
|
Function("a", "{bb}", "return a");
|
|
Function("[[a]]", "[{bb}]", 'return a');
|
|
}
|
|
}
|
|
|
|
|