From 8eda7cb7d8b4ebd811ede32706ecd29643b43f8b Mon Sep 17 00:00:00 2001 From: Peter Marki Date: Mon, 30 Nov 2020 10:50:13 +0100 Subject: [PATCH] Remove LITERAL_POOL_IN_EXPORT flag at class statement end (#4348) Fixes #4265 JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu --- jerry-core/parser/js/js-scanner.c | 3 +++ .../es.next/regression-test-issue-4265.js | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 tests/jerry/es.next/regression-test-issue-4265.js diff --git a/jerry-core/parser/js/js-scanner.c b/jerry-core/parser/js/js-scanner.c index d355d0c75..6052fc02d 100644 --- a/jerry-core/parser/js/js-scanner.c +++ b/jerry-core/parser/js/js-scanner.c @@ -2130,6 +2130,9 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */ terminator_found = true; parser_stack_pop_uint8 (context_p); +#if ENABLED (JERRY_MODULE_SYSTEM) + scanner_context_p->active_literal_pool_p->status_flags &= (uint16_t) ~SCANNER_LITERAL_POOL_IN_EXPORT; +#endif /* ENABLED (JERRY_MODULE_SYSTEM) */ lexer_next_token (context_p); continue; } diff --git a/tests/jerry/es.next/regression-test-issue-4265.js b/tests/jerry/es.next/regression-test-issue-4265.js new file mode 100644 index 000000000..a0c8965b8 --- /dev/null +++ b/tests/jerry/es.next/regression-test-issue-4265.js @@ -0,0 +1,19 @@ +// 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. + +try { + eval ("export class Dog {constructor() {}}; for (var a") +} catch (e) { + assert (e instanceof SyntaxError) +}