change token_error() to croak() for rest element errors

This commit is contained in:
kzc 2017-08-02 00:35:45 -04:00
parent 9159f0ecd4
commit 529ac31df4

View File

@ -1522,7 +1522,7 @@ function parse($TEXT, options) {
} }
if (is_expand) { if (is_expand) {
if (!is("punc", "]")) { if (!is("punc", "]")) {
token_error(S.token, "Rest element must be last element"); croak("Rest element must be last element");
} }
elements[elements.length - 1] = new AST_Expansion({ elements[elements.length - 1] = new AST_Expansion({
start: expand_token, start: expand_token,
@ -1606,7 +1606,7 @@ function parse($TEXT, options) {
} }
if (is_expand) { if (is_expand) {
if (!is("punc", "}")) { if (!is("punc", "}")) {
token_error(S.token, "Rest element must be last element"); croak("Rest element must be last element");
} }
} }
else if (is("operator", "=")) { else if (is("operator", "=")) {