Implement spread operator for function call arguments (#3329)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-11-19 14:06:12 +01:00
committed by Dániel Bátyai
parent bf630c0c54
commit 22766a855e
9 changed files with 442 additions and 21 deletions
+8 -2
View File
@@ -443,8 +443,14 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
#endif /* ENABLED (JERRY_ES2015) */
case LEXER_COMMA:
{
/* Elision. */
if (stack_top != SCAN_STACK_ARRAY_LITERAL)
/* Elision or spread arguments */
#if ENABLED (JERRY_ES2015)
bool raise_error = (stack_top != SCAN_STACK_PAREN_EXPRESSION && stack_top != SCAN_STACK_ARRAY_LITERAL);
#else /* !ENABLED (JERRY_ES2015) */
bool raise_error = stack_top != SCAN_STACK_ARRAY_LITERAL;
#endif /* ENABLED (JERRY_ES2015) */
if (raise_error)
{
scanner_raise_error (context_p);
}