The constructor check should return false for arrow and generator functions (#4328)

The previous `ecma_is_constructor` implementation did not checked if the
target function was an arrow or generator function. This resulted in
an incorrect execution for these function types.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
Péter Gál
2020-11-24 12:46:44 +01:00
committed by GitHub
parent cc52282f34
commit 3af3597f2e
5 changed files with 130 additions and 105 deletions
+1 -2
View File
@@ -1314,8 +1314,7 @@ opfunc_init_class (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
else if (!ecma_is_value_null (super_class))
{
/* 6.f, 6.g.i */
if (!ecma_is_constructor (super_class)
|| ecma_op_function_is_generator (ecma_get_object_from_value (super_class)))
if (!ecma_is_constructor (super_class))
{
return ecma_raise_type_error ("Class extends value is not a constructor or null");
}