Implement ES2015 class feature (part II.) (#2439)

This patch is the second milestone of the implementation of this new language element.

Supported:
 - Single class inheritance
 - Functionality of 'super' keyword
 - Implicit constructor in class heritage
 - Specific behaviour while extending with the built-in 'Array' or '%TypedArray%' object
 - Abstract subclasses (Mix-ins)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2018-10-25 16:00:48 +02:00
committed by Akos Kiss
parent e0e6363f85
commit d1860d0e34
54 changed files with 2543 additions and 199 deletions
+12 -3
View File
@@ -41,7 +41,9 @@ ecma_init_global_lex_env (void)
{
ecma_object_t *glob_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL);
JERRY_CONTEXT (ecma_global_lex_env_p) = ecma_create_object_lex_env (NULL, glob_obj_p);
JERRY_CONTEXT (ecma_global_lex_env_p) = ecma_create_object_lex_env (NULL,
glob_obj_p,
ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);
ecma_deref_object (glob_obj_p);
} /* ecma_init_global_lex_env */
@@ -86,7 +88,9 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
JERRY_ASSERT (lex_env_p != NULL
&& ecma_is_lexical_environment (lex_env_p));
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
ecma_lexical_environment_type_t lex_env_type = ecma_get_lex_env_type (lex_env_p);
if (lex_env_type == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
{
ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);
@@ -94,7 +98,12 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
}
else
{
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);
#ifndef CONFIG_DISABLE_ES2015_CLASS
JERRY_ASSERT (lex_env_type == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND
|| lex_env_type == ECMA_LEXICAL_ENVIRONMENT_SUPER_OBJECT_BOUND);
#else /* CONFIG_DISABLE_ES2015_CLASS */
JERRY_ASSERT (lex_env_type == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND);
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);