Fix three async function issues. (#3863)

- Invalid assert
- Add missing async prefix check when an identifier is enclosed in brackets
- Adding a new byte-code

Fixes #3855
Fixes #3856
Fixes #3857

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-06-08 10:25:34 +02:00
committed by GitHub
parent c2c623df79
commit ab2e821777
8 changed files with 59 additions and 14 deletions
+6 -6
View File
@@ -1018,7 +1018,8 @@ parser_post_processing (parser_context_t *context_p) /**< context */
length++;
#if ENABLED (JERRY_ES2015)
if (ext_opcode == CBC_EXT_RETURN_PROMISE)
if (ext_opcode == CBC_EXT_RETURN_PROMISE
|| ext_opcode == CBC_EXT_RETURN_PROMISE_UNDEFINED)
{
last_opcode = CBC_RETURN;
}
@@ -1163,7 +1164,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
#if ENABLED (JERRY_ES2015)
if (context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)
{
length += 2;
length++;
}
#endif /* ENABLED (JERRY_ES2015) */
@@ -1540,10 +1541,9 @@ parser_post_processing (parser_context_t *context_p) /**< context */
#if ENABLED (JERRY_ES2015)
if (context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)
{
dst_p[-1] = CBC_PUSH_UNDEFINED;
dst_p[0] = CBC_EXT_OPCODE;
dst_p[1] = CBC_EXT_RETURN_PROMISE;
dst_p += 2;
dst_p[-1] = CBC_EXT_OPCODE;
dst_p[0] = CBC_EXT_RETURN_PROMISE_UNDEFINED;
dst_p++;
}
#endif /* ENABLED (JERRY_ES2015) */
}