diff --git a/jerry-core/vm/vm.c b/jerry-core/vm/vm.c index d98248c4a..2eb7284eb 100644 --- a/jerry-core/vm/vm.c +++ b/jerry-core/vm/vm.c @@ -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. */ diff --git a/tests/test262-es6-excludelist.xml b/tests/test262-es6-excludelist.xml index 0c124489f..03e3dc209 100644 --- a/tests/test262-es6-excludelist.xml +++ b/tests/test262-es6-excludelist.xml @@ -303,7 +303,6 @@ No longer a SyntaxError in ES11 No longer a SyntaxError in ES11 - ES2018 change: next method must be cached diff --git a/tests/test262-esnext-excludelist.xml b/tests/test262-esnext-excludelist.xml index 191ad361d..1e588bb0d 100644 --- a/tests/test262-esnext-excludelist.xml +++ b/tests/test262-esnext-excludelist.xml @@ -4060,7 +4060,6 @@ -