Call filter arguments after the global arguments are parsed. (#3511)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg 2020-01-14 15:10:19 +01:00 committed by Dániel Bátyai
parent 0fd1ed6f27
commit d6070a9fed
3 changed files with 10 additions and 1 deletions

View File

@ -964,7 +964,7 @@ scanner_filter_arguments (parser_context_t *context_p, /**< context */
new_literal_p = (lexer_lit_location_t *) parser_list_append (context_p, &new_literal_pool_p->literal_pool);
*new_literal_p = *literal_p;
}
else
else if (prev_literal_pool_p != NULL)
{
/* Propagate literal to upper level. */
lexer_lit_location_t *literal_location_p = scanner_add_custom_literal (context_p,

View File

@ -2759,6 +2759,7 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
context_p->line = 1;
context_p->column = 1;
scanner_filter_arguments (context_p, &scanner_context);
lexer_next_token (context_p);
scanner_check_directives (context_p, &scanner_context);
continue;

View File

@ -68,3 +68,11 @@ function l(a = 0, ...[b, c = 1, d = 4])
assert(d === 4);
}
l(1,2,3);
Function("{a, x:b}","[c]", "{ 'dd':d, e = Math.cos(0)}",
"assert(a === 1);" +
"assert(b === undefined);" +
"assert(c === 3);" +
"assert(d === 4);" +
"assert(e === 1);"
)({a:1, b:3}, [3], {a:1, b:2, dd:4});