From 5895b96bdbebd49348691e9f6ffd0fabeadb5227 Mon Sep 17 00:00:00 2001 From: Robert Fancsik Date: Thu, 28 May 2020 16:23:56 +0200 Subject: [PATCH] Class extends expression should be parsed is strict mode (#3801) JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu --- jerry-core/parser/js/js-parser-expr.c | 10 +++++----- tests/test262-es6-excludelist.xml | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/jerry-core/parser/js/js-parser-expr.c b/jerry-core/parser/js/js-parser-expr.c index cc775db54..9f901fe7a 100644 --- a/jerry-core/parser/js/js-parser-expr.c +++ b/jerry-core/parser/js/js-parser-expr.c @@ -798,6 +798,11 @@ parser_parse_class (parser_context_t *context_p, /**< context */ parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_ANONYMOUS_CLASS_ENV); } + bool is_strict = (context_p->status_flags & PARSER_IS_STRICT) != 0; + + /* 14.5. A ClassBody is always strict code. */ + context_p->status_flags |= PARSER_IS_STRICT; + if (context_p->token.type == LEXER_KEYW_EXTENDS) { lexer_next_token (context_p); @@ -815,11 +820,6 @@ parser_parse_class (parser_context_t *context_p, /**< context */ parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_EXPECTED); } - bool is_strict = context_p->status_flags & PARSER_IS_STRICT; - - /* 14.5. A ClassBody is always strict code. */ - context_p->status_flags |= PARSER_IS_STRICT; - /* ClassDeclaration is parsed. Continue with class body. */ parser_parse_class_literal (context_p, opts); diff --git a/tests/test262-es6-excludelist.xml b/tests/test262-es6-excludelist.xml index 6126b313d..6f3007122 100644 --- a/tests/test262-es6-excludelist.xml +++ b/tests/test262-es6-excludelist.xml @@ -517,7 +517,6 @@ -