Fix 'arguments' and 'caller' properties lazy listing in ES2015 profile (#3539)

This patch fixes #3536.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-02-03 15:12:59 +01:00
committed by GitHub
parent 7734f87fbb
commit 563a5d93e9
3 changed files with 52 additions and 10 deletions
@@ -1814,18 +1814,24 @@ ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, /**< functio
/* 'prototype' property is non-enumerable (ECMA-262 v5, 13.2.18) */
ecma_collection_push_back (for_non_enumerable_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_PROTOTYPE));
#if ENABLED (JERRY_ES2015)
bool append_caller_and_arguments = !(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE);
#else /* !ENABLED (JERRY_ES2015) */
bool append_caller_and_arguments = (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE);
#endif /* ENABLED (JERRY_ES2015) */
if (append_caller_and_arguments)
{
/* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (for_non_enumerable_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));
/* 'arguments' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (for_non_enumerable_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_ARGUMENTS));
}
#if ENABLED (JERRY_ES2015)
}
#endif /* ENABLED (JERRY_ES2015) */
if (bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
{
/* 'caller' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (for_non_enumerable_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_CALLER));
/* 'arguments' property is non-enumerable (ECMA-262 v5, 13.2.5) */
ecma_collection_push_back (for_non_enumerable_p, ecma_make_magic_string_value (LIT_MAGIC_STRING_ARGUMENTS));
}
} /* ecma_op_function_list_lazy_property_names */
/**