Fix ecma_op_resolve_reference_base for super object bound lexical environments (#2668)

All ECMA_LEXICAL_ENVIRONMENT_SUPER_OBJECT_BOUND type lexical environments should return their outer reference during resolving syntactic reference.
This patch fixes #2666.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-01-03 13:37:01 +01:00
committed by Robert Sipka
parent 1068b07cbe
commit b80935ba92
3 changed files with 31 additions and 5 deletions
@@ -96,12 +96,7 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
}
else
{
#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);
@@ -48,6 +48,14 @@ ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, /**< starting lexical
while (lex_env_iter_p != NULL)
{
#ifndef CONFIG_DISABLE_ES2015_CLASS
if (ecma_get_lex_env_type (lex_env_iter_p) == ECMA_LEXICAL_ENVIRONMENT_SUPER_OBJECT_BOUND)
{
lex_env_iter_p = ecma_get_lex_env_outer_reference (lex_env_iter_p);
JERRY_ASSERT (lex_env_iter_p != NULL);
}
#endif /* !CONFIG_DISABLE_ES2015_CLASS */
if (ecma_op_has_binding (lex_env_iter_p, name_p))
{
return lex_env_iter_p;