Error should be thrown later when calling super multiple times (#4256)

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
This commit is contained in:
Dániel Bátyai
2020-10-10 18:58:31 +02:00
committed by GitHub
parent 596964ae0d
commit d1f73752ff
3 changed files with 7 additions and 7 deletions
+7 -5
View File
@@ -577,11 +577,7 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
ecma_property_t *prop_p = ecma_op_get_this_property (frame_ctx_p->lex_env_p);
if (ecma_op_this_binding_is_initialized (prop_p))
{
completion_value = ecma_raise_reference_error (ECMA_ERR_MSG ("Super constructor may only be called once"));
}
else if (!ecma_is_constructor (func_value))
if (!ecma_is_constructor (func_value))
{
completion_value = ecma_raise_type_error (ECMA_ERR_MSG ("Class extends value is not a constructor."));
}
@@ -609,6 +605,12 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
ecma_free_value (proto_value);
}
if (!ECMA_IS_VALUE_ERROR (completion_value) && ecma_op_this_binding_is_initialized (prop_p))
{
ecma_free_value (completion_value);
completion_value = ecma_raise_reference_error (ECMA_ERR_MSG ("Super constructor may only be called once"));
}
}
/* Free registers. */