diff --git a/jerry-core/parser/js/js-parser.c b/jerry-core/parser/js/js-parser.c index 43c9a7128..7d0445196 100644 --- a/jerry-core/parser/js/js-parser.c +++ b/jerry-core/parser/js/js-parser.c @@ -1822,6 +1822,7 @@ parser_parse_function_arguments (parser_context_t *context_p, /**< context */ #if ENABLED (JERRY_ESNEXT) bool has_complex_argument = (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_HAS_COMPLEX_ARGUMENT) != 0; #endif /* ENABLED (JERRY_ESNEXT) */ + bool is_strict = (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_IS_STRICT) != 0; scanner_create_variables (context_p, SCANNER_CREATE_VARS_IS_FUNCTION_ARGS); scanner_set_active (context_p); @@ -2099,6 +2100,11 @@ parser_parse_function_arguments (parser_context_t *context_p, /**< context */ #endif /* ENABLED (JERRY_ESNEXT) */ scanner_create_variables (context_p, SCANNER_CREATE_VARS_IS_FUNCTION_BODY); + + if (is_strict) + { + context_p->status_flags |= PARSER_IS_STRICT; + } } /* parser_parse_function_arguments */ #ifndef JERRY_NDEBUG @@ -2264,6 +2270,14 @@ parser_parse_source (const uint8_t *arg_list_p, /**< function argument list */ context.module_current_node_p = NULL; #endif /* ENABLED (JERRY_MODULE_SYSTEM) */ + JERRY_ASSERT (context.next_scanner_info_p->source_p == context.source_p); + JERRY_ASSERT (context.next_scanner_info_p->type == SCANNER_TYPE_FUNCTION); + + if (context.next_scanner_info_p->u8_arg & SCANNER_FUNCTION_IS_STRICT) + { + context.status_flags |= PARSER_IS_STRICT; + } + PARSER_TRY (context.try_buffer) { /* Pushing a dummy value ensures the stack is never empty. diff --git a/jerry-core/parser/js/js-scanner-util.c b/jerry-core/parser/js/js-scanner-util.c index 75eec3d52..e28e1dfc7 100644 --- a/jerry-core/parser/js/js-scanner-util.c +++ b/jerry-core/parser/js/js-scanner-util.c @@ -775,6 +775,11 @@ scanner_pop_literal_pool (parser_context_t *context_p, /**< context */ { u8_arg |= SCANNER_FUNCTION_LEXICAL_ENV_NEEDED; } + + if (status_flags & SCANNER_LITERAL_POOL_IS_STRICT) + { + u8_arg |= SCANNER_FUNCTION_IS_STRICT; + } #endif /* ENABLED (JERRY_ESNEXT) */ info_p->u8_arg = u8_arg; diff --git a/jerry-core/parser/js/js-scanner.h b/jerry-core/parser/js/js-scanner.h index 0ed07975b..9608ba78f 100644 --- a/jerry-core/parser/js/js-scanner.h +++ b/jerry-core/parser/js/js-scanner.h @@ -236,6 +236,7 @@ typedef enum * this flag must be combined with the type of function (e.g. async) */ SCANNER_FUNCTION_ASYNC = (1 << 4), /**< function is async function */ #endif /* ENABLED (JERRY_ESNEXT) */ + SCANNER_FUNCTION_IS_STRICT = (1 << 5), /**< function is strict */ } scanner_function_flags_t; /** diff --git a/tests/test262-es6-excludelist.xml b/tests/test262-es6-excludelist.xml index 466ff92e0..0c124489f 100644 --- a/tests/test262-es6-excludelist.xml +++ b/tests/test262-es6-excludelist.xml @@ -302,7 +302,6 @@ No longer a SyntaxError in ES11 No longer a SyntaxError in ES11 -