Native modules should be unlinked state after creation (#4655)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-04-16 15:55:12 +02:00
committed by GitHub
parent 7b6743403f
commit a7a4cb29e4
3 changed files with 9 additions and 4 deletions
-1
View File
@@ -977,7 +977,6 @@ jerry_native_module_create (jerry_native_module_evaluate_callback_t callback, /*
ecma_module_t *module_p = ecma_module_create ();
module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_LINKED;
module_p->header.u.cls.u2.module_flags |= ECMA_MODULE_IS_NATIVE;
module_p->scope_p = scope_p;
module_p->local_exports_p = local_exports_p;
+3 -1
View File
@@ -936,12 +936,14 @@ restart:
if (current_module_p->scope_p == NULL)
{
JERRY_ASSERT (!(current_module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE));
/* Initialize scope for handling circular references. */
ecma_value_t result = vm_init_module_scope (current_module_p);
if (ECMA_IS_VALUE_ERROR (result))
{
module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_ERROR;
current_module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_ERROR;
goto error;
}