From 09ac2ffa67d5978de4148fcbf993fe09d4e3c70b Mon Sep 17 00:00:00 2001 From: Zoltan Herczeg Date: Mon, 18 May 2020 13:13:43 +0200 Subject: [PATCH] Update obsolote assert. (#3752) Fixes #3713. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com --- jerry-core/parser/js/js-parser-statm.c | 2 +- .../es2015/regresssion-test-issue-3713.js | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/jerry/es2015/regresssion-test-issue-3713.js diff --git a/jerry-core/parser/js/js-parser-statm.c b/jerry-core/parser/js/js-parser-statm.c index 0647a54ab..04ccbc93f 100644 --- a/jerry-core/parser/js/js-parser-statm.c +++ b/jerry-core/parser/js/js-parser-statm.c @@ -2639,7 +2639,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */ lexer_lit_location_t lit_location; parser_strict_mode_type_t strict_mode = PARSER_USE_STRICT_NOT_FOUND; - JERRY_ASSERT (context_p->stack_depth == 0); + JERRY_ASSERT (context_p->stack_depth <= 1); #ifndef JERRY_NDEBUG JERRY_ASSERT (context_p->context_stack_depth == context_p->stack_depth); #endif /* !JERRY_NDEBUG */ diff --git a/tests/jerry/es2015/regresssion-test-issue-3713.js b/tests/jerry/es2015/regresssion-test-issue-3713.js new file mode 100644 index 000000000..7dc12b6bd --- /dev/null +++ b/tests/jerry/es2015/regresssion-test-issue-3713.js @@ -0,0 +1,18 @@ +// Copyright JS Foundation and other contributors, http://js.foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +function $(b = eval()) { + "" + eval() +}