[ES6] fix parsing spread arguments that are expressions
This commit is contained in:
@@ -2371,7 +2371,7 @@ function parse($TEXT, options) {
|
|||||||
next();
|
next();
|
||||||
args.push(new AST_Expansion({
|
args.push(new AST_Expansion({
|
||||||
start: prev(),
|
start: prev(),
|
||||||
expression: as_symbol(AST_SymbolFunarg)
|
expression: expression(false)
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
args.push(expression(false));
|
args.push(expression(false));
|
||||||
|
|||||||
@@ -7,6 +7,17 @@ expand_arguments: {
|
|||||||
expect_exact: "func(a,...rest);func(...all);"
|
expect_exact: "func(a,...rest);func(...all);"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expand_expression_arguments: {
|
||||||
|
input: {
|
||||||
|
f(...a.b);
|
||||||
|
f(...a.b());
|
||||||
|
f(...(a));
|
||||||
|
f(...(a.b));
|
||||||
|
f(...a[i]);
|
||||||
|
}
|
||||||
|
expect_exact: "f(...a.b);f(...a.b());f(...a);f(...a.b);f(...a[i]);"
|
||||||
|
}
|
||||||
|
|
||||||
expand_parameters: {
|
expand_parameters: {
|
||||||
input: {
|
input: {
|
||||||
(function (a, ...b){});
|
(function (a, ...b){});
|
||||||
|
|||||||
Reference in New Issue
Block a user