Remove "arguments" and "caller" from specific functions (#3918)

As stated in ES 16.1, "arguments" and "caller" must not be created in:
- strict functions created using the Function constructor
- generator functions created using the Generator constructor
- async functions created using the AsyncFunction constructor
- functions created using the bind

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
This commit is contained in:
Rafal Walczyna
2020-06-22 19:08:13 +02:00
committed by GitHub
parent 281635cb40
commit e64fc9aca9
4 changed files with 80 additions and 7 deletions
@@ -1563,7 +1563,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
#if ENABLED (JERRY_ESNEXT)
if (!(bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE)
&& !(CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_ARROW))
&& CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags) == CBC_FUNCTION_NORMAL)
{
ecma_property_t *value_prop_p;
/* The property_name_p argument contains the name. */
@@ -1692,6 +1692,7 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
return len_prop_p;
}
#if !ENABLED (JERRY_ESNEXT)
if (ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER)
|| ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS))
{
@@ -1707,6 +1708,7 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
&caller_prop_p);
return caller_prop_p;
}
#endif /* !ENABLED (JERRY_ESNEXT) */
return NULL;
} /* ecma_op_bound_function_try_to_lazy_instantiate_property */
+1
View File
@@ -3379,6 +3379,7 @@ lexer_string_is_directive (parser_context_t *context_p) /**< context */
{
return (context_p->token.type == LEXER_SEMICOLON
|| context_p->token.type == LEXER_RIGHT_BRACE
|| context_p->token.type == LEXER_EOS
|| ((context_p->token.flags & LEXER_WAS_NEWLINE)
&& !LEXER_IS_BINARY_OP_TOKEN (context_p->token.type)
&& context_p->token.type != LEXER_LEFT_PAREN