Only last parameter between parentheses can have spread
This commit is contained in:
committed by
Richard van Velzen
parent
f9cab7ad61
commit
6b03b800b3
@@ -1163,12 +1163,16 @@ function parse($TEXT, options) {
|
||||
while (!is("punc", ")")) {
|
||||
if (first) first = false; else expect(",");
|
||||
if (is("expand", "...")) {
|
||||
var spread_token = S.token;
|
||||
next();
|
||||
a.push(new AST_Expansion({
|
||||
start: prev(),
|
||||
expression: as_symbol(AST_SymbolFunarg),
|
||||
end: S.token,
|
||||
}));
|
||||
if (!is("punc", ")")) {
|
||||
unexpected(spread_token);
|
||||
}
|
||||
} else {
|
||||
a.push(expression(false));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user