Allow empty destructuring (#1773)
This commit is contained in:
committed by
Alex Lam S.L
parent
35bae3fcd0
commit
17f0cc359f
@@ -448,8 +448,6 @@ var AST_ArrowParametersOrSeq = DEFNODE("ArrowParametersOrSeq", "expressions", {
|
|||||||
} else if (ex instanceof AST_Hole) {
|
} else if (ex instanceof AST_Hole) {
|
||||||
return ex;
|
return ex;
|
||||||
} else if (ex instanceof AST_Destructuring) {
|
} 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);
|
ex.names = ex.names.map(to_fun_args);
|
||||||
return insert_default(ex, default_seen_above);
|
return insert_default(ex, default_seen_above);
|
||||||
} else if (ex instanceof AST_SymbolRef) {
|
} else if (ex instanceof AST_SymbolRef) {
|
||||||
|
|||||||
@@ -314,11 +314,13 @@ default_assign: {
|
|||||||
function f(a, b = 3) {
|
function f(a, b = 3) {
|
||||||
console.log(a);
|
console.log(a);
|
||||||
}
|
}
|
||||||
|
g = ([[] = 123]) => {};
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
function f(a) {
|
function f(a) {
|
||||||
console.log(a);
|
console.log(a);
|
||||||
}
|
}
|
||||||
|
g = ([[] = 123]) => {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user