Skip to content

Commit cbc3a5d

Browse files
authored
Fix function calls which name is async and has an extra comma (#4340)
Fixes #4132 JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
1 parent d2c523b commit cbc3a5d

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,16 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
278278
{
279279
if (stack_top == SCAN_STACK_PAREN_EXPRESSION)
280280
{
281-
scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
282281
parser_stack_pop_uint8 (context_p);
282+
283+
#if ENABLED (JERRY_ESNEXT)
284+
if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)
285+
{
286+
scanner_add_async_literal (context_p, scanner_context_p);
287+
}
288+
#endif /* ENABLED (JERRY_ESNEXT) */
289+
290+
scanner_context_p->mode = SCAN_MODE_POST_PRIMARY_EXPRESSION;
283291
break;
284292
}
285293
/* FALLTHRU */
Lines changed: 19 additions & 0 deletions
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+
function async(p) {
16+
return p;
17+
}
18+
19+
assert(async("X",) === "X")

0 commit comments

Comments
 (0)