Add global status flags for the parser. (#3572)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-02-24 11:22:20 +01:00
committed by GitHub
parent cdbabc8c30
commit bd2696f7c7
10 changed files with 42 additions and 60 deletions
+2 -1
View File
@@ -1412,7 +1412,8 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
/* Check if "new.target" is written here. */
if (scanner_try_scan_new_target (context_p))
{
if (!(context_p->status_flags & PARSER_IS_FUNCTION))
if (!(context_p->status_flags & PARSER_IS_FUNCTION)
&& !(context_p->global_status_flags & ECMA_PARSE_CALLED_FROM_FUNCTION))
{
parser_raise_error (context_p, PARSER_ERR_NEW_TARGET_NOT_ALLOWED);
}