From 17f0cc359f50bf6fe9673ef87e3839c2f3c4553e Mon Sep 17 00:00:00 2001 From: Anthony Van de Gejuchte Date: Mon, 3 Apr 2017 11:21:27 +0200 Subject: [PATCH] Allow empty destructuring (#1773) --- lib/ast.js | 2 -- test/compress/harmony.js | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ast.js b/lib/ast.js index 54e3f2e6..96c64354 100644 --- a/lib/ast.js +++ b/lib/ast.js @@ -448,8 +448,6 @@ var AST_ArrowParametersOrSeq = DEFNODE("ArrowParametersOrSeq", "expressions", { } else if (ex instanceof AST_Hole) { return ex; } else if (ex instanceof AST_Destructuring) { - if (ex.names.length == 0) - croak("Invalid destructuring function parameter", ex.start.line, ex.start.col); ex.names = ex.names.map(to_fun_args); return insert_default(ex, default_seen_above); } else if (ex instanceof AST_SymbolRef) { diff --git a/test/compress/harmony.js b/test/compress/harmony.js index 0fecf548..eedb3377 100644 --- a/test/compress/harmony.js +++ b/test/compress/harmony.js @@ -314,11 +314,13 @@ default_assign: { function f(a, b = 3) { console.log(a); } + g = ([[] = 123]) => {}; } expect: { function f(a) { console.log(a); } + g = ([[] = 123]) => {}; } }