Skip to content

Commit efe63a5

Browse files
author
Robert Fancsik
authored
Fix parsing unterminated let statement (#4808)
This patch fixes #4754 JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent 9ed695f commit efe63a5

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,10 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
15501550
break;
15511551
}
15521552

1553+
/* FALLTHRU */
1554+
}
1555+
case LEXER_KEYW_LET:
1556+
{
15531557
if (context_p->next_scanner_info_p->source_p == context_p->source_p
15541558
&& context_p->next_scanner_info_p->type != SCANNER_TYPE_BLOCK)
15551559
{
@@ -1563,9 +1567,9 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
15631567
}
15641568

15651569
context_p->token.type = LEXER_KEYW_LET;
1570+
15661571
/* FALLTHRU */
15671572
}
1568-
case LEXER_KEYW_LET:
15691573
case LEXER_KEYW_CONST:
15701574
{
15711575
if (context_p->next_scanner_info_p->source_p == source_p)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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 a { b() { for (let

0 commit comments

Comments
 (0)