Rework the core of class parsing/runtime semantic (#3598)

Changes:
 - Use the pre-scanner to provide information for the parser about the existence of the class constructor
 - The allocation of the super declarative environment is no longer needed
 - The VM frame context holds the information about the this binding status
 - Reduce the number of class related VM/CBC instructions
 - Improve ecma_op_function_{construct, call} to properly set new.target

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-03-16 14:37:47 +01:00
committed by GitHub
parent 56b9f098ab
commit bfd2639634
49 changed files with 1671 additions and 1490 deletions
+3 -3
View File
@@ -2762,9 +2762,8 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
* In this case we use a synthetic name for them. */
context_p->token.type = LEXER_LITERAL;
context_p->token.keyword_type = LEXER_EOS;
context_p->token.lit_location.type = LEXER_IDENT_LITERAL;
context_p->token.lit_location.has_escape = false;
lexer_construct_literal_object (context_p, &lexer_default_literal, literal_type);
context_p->token.lit_location = lexer_default_literal;
lexer_construct_literal_object (context_p, &context_p->token.lit_location, literal_type);
context_p->status_flags &= (uint32_t) ~(PARSER_MODULE_DEFAULT_CLASS_OR_FUNC);
return;
}
@@ -2917,6 +2916,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
if (is_class_method && lexer_compare_literal_to_string (context_p, "constructor", 11))
{
context_p->token.type = LEXER_CLASS_CONSTRUCTOR;
context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;
return;
}
#endif /* ENABLED (JERRY_ES2015) */