From b4b55a67a2b5bf841db512ee6fe37591c649bf88 Mon Sep 17 00:00:00 2001 From: Zoltan Herczeg Date: Thu, 14 Nov 2019 13:48:58 +0100 Subject: [PATCH] Fix for propagating arguments reference from nested blocks. (#3309) JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com --- jerry-core/parser/js/js-scanner-util.c | 1 + tests/jerry/arguments.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/jerry-core/parser/js/js-scanner-util.c b/jerry-core/parser/js/js-scanner-util.c index 10960ca11..a8bfe924f 100644 --- a/jerry-core/parser/js/js-scanner-util.c +++ b/jerry-core/parser/js/js-scanner-util.c @@ -371,6 +371,7 @@ scanner_push_literal_pool (parser_context_t *context_p, /**< context */ if (!(status_flags & SCANNER_LITERAL_POOL_FUNCTION)) { JERRY_ASSERT (prev_literal_pool_p != NULL); + status_flags |= SCANNER_LITERAL_POOL_NO_ARGUMENTS; if (prev_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH) { diff --git a/tests/jerry/arguments.js b/tests/jerry/arguments.js index a9b3193fe..b1014d599 100644 --- a/tests/jerry/arguments.js +++ b/tests/jerry/arguments.js @@ -129,3 +129,17 @@ fn_expr (1); (function () { var a = [arguments]; })(); + +function nested_args() +{ + var a; + for (var i = 0; i < 1; i++) + { + if (i == 0) + { + a = arguments[i]; + } + } + assert(a === 3); +} +nested_args(3);