Skip to content

Commit d6070a9

Browse files
zherczegdbatyai
authored andcommitted
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
1 parent 0fd1ed6 commit d6070a9

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

jerry-core/parser/js/js-scanner-util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ scanner_filter_arguments (parser_context_t *context_p, /**< context */
964964
new_literal_p = (lexer_lit_location_t *) parser_list_append (context_p, &new_literal_pool_p->literal_pool);
965965
*new_literal_p = *literal_p;
966966
}
967-
else
967+
else if (prev_literal_pool_p != NULL)
968968
{
969969
/* Propagate literal to upper level. */
970970
lexer_lit_location_t *literal_location_p = scanner_add_custom_literal (context_p,

jerry-core/parser/js/js-scanner.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,7 @@ scanner_scan_all (parser_context_t *context_p, /**< context */
27592759
context_p->line = 1;
27602760
context_p->column = 1;
27612761

2762+
scanner_filter_arguments (context_p, &scanner_context);
27622763
lexer_next_token (context_p);
27632764
scanner_check_directives (context_p, &scanner_context);
27642765
continue;

tests/jerry/es2015/function-pattern2.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,11 @@ function l(a = 0, ...[b, c = 1, d = 4])
6868
assert(d === 4);
6969
}
7070
l(1,2,3);
71+
72+
Function("{a, x:b}","[c]", "{ 'dd':d, e = Math.cos(0)}",
73+
"assert(a === 1);" +
74+
"assert(b === undefined);" +
75+
"assert(c === 3);" +
76+
"assert(d === 4);" +
77+
"assert(e === 1);"
78+
)({a:1, b:3}, [3], {a:1, b:2, dd:4});

0 commit comments

Comments
 (0)