Skip to content

Commit 1bf52f5

Browse files
authored
Fix initializer detection in for-in expressions. (#3884)
Also fix column update when comments are parsed. Fixes #3882 JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
1 parent 6d9d232 commit 1bf52f5

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
388388
context_p->source_p++;
389389

390390
if (context_p->source_p < source_end_p
391-
&& IS_UTF8_INTERMEDIATE_OCTET (context_p->source_p[0]))
391+
&& !IS_UTF8_INTERMEDIATE_OCTET (context_p->source_p[0]))
392392
{
393393
context_p->column++;
394394
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
13361336
parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT
13371337
: CBC_EXT_FOR_OF_GET_NEXT);
13381338

1339-
if (context_p->next_scanner_info_p->source_p == context_p->source_p)
1339+
if (context_p->next_scanner_info_p->source_p == (context_p->source_p + 1))
13401340
{
13411341
JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER);
13421342

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+
for(let{[function(){}]:{}} = ()=>{} in []) ;

0 commit comments

Comments
 (0)