diff --git a/jerry-core/vm/opcodes.c b/jerry-core/vm/opcodes.c index 0b839f515..39a4ad4fd 100644 --- a/jerry-core/vm/opcodes.c +++ b/jerry-core/vm/opcodes.c @@ -1548,6 +1548,17 @@ opfunc_form_super_reference (ecma_value_t **vm_stack_top_p, /**< current vm stac ecma_value_t prop_name, /**< property name to resolve */ uint8_t opcode) /**< current cbc opcode */ { + if (CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags) == CBC_FUNCTION_CONSTRUCTOR) + { + 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)) + { + return ecma_raise_reference_error (ECMA_ERR_MSG ("Must call super constructor in derived class before " + "accessing 'this' or returning from it.")); + } + } + ecma_value_t parent = ecma_op_resolve_super_base (frame_ctx_p->lex_env_p); if (ECMA_IS_VALUE_ERROR (parent)) diff --git a/tests/test262-es6-excludelist.xml b/tests/test262-es6-excludelist.xml index 7ad1de832..1ea4f7d10 100644 --- a/tests/test262-es6-excludelist.xml +++ b/tests/test262-es6-excludelist.xml @@ -306,7 +306,6 @@ 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 7f83a8841..b28c699c7 100644 --- a/tests/test262-esnext-excludelist.xml +++ b/tests/test262-esnext-excludelist.xml @@ -3754,11 +3754,9 @@ - - @@ -4079,7 +4077,6 @@ -