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) +}