Skip to content

Commit 1068b07

Browse files
rerobikarobertsipka
authored andcommitted
Ensure that inner classes do not inherit the parent's class HAS_SUPER flag. (#2669)
This patch fixes #2667. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
1 parent b69f3fd commit 1068b07

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

jerry-core/parser/js/js-parser-expr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@ parser_parse_class (parser_context_t *context_p, /**< context */
560560
{
561561
JERRY_ASSERT (context_p->token.type == LEXER_KEYW_CLASS);
562562

563+
context_p->status_flags &= (uint32_t) ~PARSER_CLASS_HAS_SUPER;
564+
563565
uint16_t class_ident_index = PARSER_MAXIMUM_NUMBER_OF_LITERALS;
564566

565567
if (is_statement)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright JS Foundation and other contributors, http://js.foundation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
try {
16+
eval ("new Strin = class extends f ()() { constructor () { var C = class extends$B {}");
17+
assert (false);
18+
} catch (e) {
19+
assert (e instanceof SyntaxError);
20+
}

0 commit comments

Comments
 (0)