diff --git a/jerry-core/ecma/operations/ecma-function-object.c b/jerry-core/ecma/operations/ecma-function-object.c index 8cbf3ce2f..befad242c 100644 --- a/jerry-core/ecma/operations/ecma-function-object.c +++ b/jerry-core/ecma/operations/ecma-function-object.c @@ -2248,7 +2248,8 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio #endif /* JERRY_ESNEXT */ #if JERRY_ESNEXT - if (!CBC_FUNCTION_HAS_PROTOTYPE (bytecode_data_p->status_flags)) + if (!CBC_FUNCTION_HAS_PROTOTYPE (bytecode_data_p->status_flags) + || (CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_CONSTRUCTOR)) { return; } diff --git a/jerry-core/parser/js/js-parser-expr.c b/jerry-core/parser/js/js-parser-expr.c index bb22e43fa..c656a29d7 100644 --- a/jerry-core/parser/js/js-parser-expr.c +++ b/jerry-core/parser/js/js-parser-expr.c @@ -520,7 +520,8 @@ parser_is_constructor_literal (parser_context_t *context_p) /**< context */ */ static bool parser_parse_class_body (parser_context_t *context_p, /**< context */ - parser_class_literal_opts_t opts) /**< class literal parsing options */ + parser_class_literal_opts_t opts, /**< class literal parsing options */ + uint16_t class_name_index) /**< class literal index */ { JERRY_ASSERT (context_p->token.type == LEXER_LEFT_BRACE); @@ -541,6 +542,11 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */ parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR); } + if (class_name_index != PARSER_INVALID_LITERAL_INDEX) + { + parser_emit_cbc_ext_literal (context_p, CBC_EXT_SET_CLASS_NAME, class_name_index); + } + parser_emit_cbc_ext (context_p, CBC_EXT_INIT_CLASS); bool is_static = false; @@ -1014,12 +1020,11 @@ parser_parse_class (parser_context_t *context_p, /**< context */ } /* ClassDeclaration is parsed. Continue with class body. */ - bool has_static_field = parser_parse_class_body (context_p, opts); + bool has_static_field = parser_parse_class_body (context_p, opts, class_name_index); if (class_name_index != PARSER_INVALID_LITERAL_INDEX) { parser_emit_cbc_ext_literal (context_p, CBC_EXT_FINALIZE_NAMED_CLASS, class_name_index); - parser_emit_cbc_ext_literal (context_p, CBC_EXT_SET_CLASS_NAME, class_name_index); PARSER_MINUS_EQUAL_U16 (context_p->scope_stack_top, 1); } else diff --git a/tests/jerry/es.next/class-fields3.js b/tests/jerry/es.next/class-fields3.js index fac1fd697..9de4be0bb 100644 --- a/tests/jerry/es.next/class-fields3.js +++ b/tests/jerry/es.next/class-fields3.js @@ -78,6 +78,6 @@ let C3 = class C4 { static yy = this } -assert(Reflect.ownKeys(C3).toString() === "length,prototype,f,name,xx,yy") +assert(Reflect.ownKeys(C3).toString() === "length,name,prototype,f,xx,yy") check_property(C3, "xx", C3) check_property(C3, "yy", C3) diff --git a/tests/test262-es6-excludelist.xml b/tests/test262-es6-excludelist.xml index 0b02934d0..2b203c4fb 100644 --- a/tests/test262-es6-excludelist.xml +++ b/tests/test262-es6-excludelist.xml @@ -335,4 +335,7 @@ Outdated test, anonymous functions should now have a name property Outdated test, anonymous functions should now have a name property Outdated test, anonymous functions should now have a name property + ES12 15.7.14.15.d: The evaluation order has been changed + ES12 15.7.14.15.d: The evaluation order has been changed + ES12 15.7.14.15.d: The evaluation order has been changed diff --git a/tests/test262-esnext-excludelist.xml b/tests/test262-esnext-excludelist.xml index 00f28d23e..8cdf8def6 100644 --- a/tests/test262-esnext-excludelist.xml +++ b/tests/test262-esnext-excludelist.xml @@ -61,9 +61,6 @@ - - -