From 3ec6b68063a8b39e0b3c917614df6ce8c81f358d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20B=C3=A1tyai?= Date: Mon, 6 May 2019 17:35:33 +0200 Subject: [PATCH] Clear top module context after local variables have been imported (#2859) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes an assertion failure which was caused by incorrectly importing the same variables multiple times. Co-authored-by: Marko Fabo JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu --- jerry-core/vm/vm.c | 2 ++ tests/jerry/es2015/module-import-04.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/jerry/es2015/module-import-04.js diff --git a/jerry-core/vm/vm.c b/jerry-core/vm/vm.c index 86f1f404d..8bc2584a4 100644 --- a/jerry-core/vm/vm.c +++ b/jerry-core/vm/vm.c @@ -3603,6 +3603,8 @@ vm_run (const ecma_compiled_code_t *bytecode_header_p, /**< byte-code data heade { return ret_value; } + + JERRY_CONTEXT (module_top_context_p) = NULL; } #endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ diff --git a/tests/jerry/es2015/module-import-04.js b/tests/jerry/es2015/module-import-04.js new file mode 100644 index 000000000..468c3dc36 --- /dev/null +++ b/tests/jerry/es2015/module-import-04.js @@ -0,0 +1,16 @@ +/* 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. + */ + +import "tests/jerry/es2015/module-import-01.js"