Skip to content

Commit 2dbb6f7

Browse files
authored
Fix parsing class body that includes stray semicolon after a static block (#5145)
JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi [email protected]
1 parent 4e89e18 commit 2dbb6f7

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -2700,6 +2700,12 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
27002700
identifier_found = true;
27012701
}
27022702

2703+
if (context_p->token.type == LEXER_SEMICOLON)
2704+
{
2705+
scanner_context.mode = SCAN_MODE_CLASS_BODY;
2706+
continue;
2707+
}
2708+
27032709
if (!identifier_found)
27042710
{
27052711
scanner_raise_error (context_p);
@@ -2728,12 +2734,6 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
27282734
break;
27292735
}
27302736

2731-
if (context_p->token.type == LEXER_SEMICOLON)
2732-
{
2733-
scanner_context.mode = SCAN_MODE_CLASS_BODY;
2734-
continue;
2735-
}
2736-
27372737
if (context_p->token.type != LEXER_RIGHT_BRACE && !(context_p->token.flags & LEXER_WAS_NEWLINE))
27382738
{
27392739
scanner_raise_error (context_p);
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
class c {
16+
static {
17+
}
18+
;
19+
}

0 commit comments

Comments
 (0)