Skip to content

Commit f3d49f6

Browse files
zherczegdbatyai
authored andcommitted
Always mark the identifers which are propagated to upper level after argument parsing. (#3516)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
1 parent 22eabd0 commit f3d49f6

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -970,10 +970,7 @@ scanner_filter_arguments (parser_context_t *context_p, /**< context */
970970
lexer_lit_location_t *literal_location_p = scanner_add_custom_literal (context_p,
971971
prev_literal_pool_p,
972972
literal_p);
973-
if (type & SCANNER_LITERAL_NO_REG)
974-
{
975-
type |= SCANNER_LITERAL_NO_REG;
976-
}
973+
type |= SCANNER_LITERAL_NO_REG;
977974

978975
#if ENABLED (JERRY_ES2015)
979976
type |= SCANNER_LITERAL_IS_USED;

tests/jerry/es2015/function-pattern2.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,18 @@ Function("{a, x:b}","[c]", "{ 'dd':d, e = Math.cos(0)}",
7676
"assert(d === 4);" +
7777
"assert(e === 1);"
7878
)({a:1, b:3}, [3], {a:1, b:2, dd:4});
79+
80+
function m()
81+
{
82+
var prop_name = "x";
83+
var def_val = 123;
84+
85+
function g({[prop_name]: a, b = def_val })
86+
{
87+
assert(a === 12);
88+
assert(b === 123);
89+
}
90+
91+
g({ x:12 })
92+
}
93+
m();

0 commit comments

Comments
 (0)