Implement yield* operator (#3923)
Missing features: - caching next() method (this also true for normal generators) - automatic sync to async generator conversion JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -27,7 +27,7 @@ JERRY_STATIC_ASSERT ((sizeof (cbc_uint16_arguments_t) % sizeof (jmem_cpointer_t)
|
||||
*/
|
||||
JERRY_STATIC_ASSERT (CBC_END == 238,
|
||||
number_of_cbc_opcodes_changed);
|
||||
JERRY_STATIC_ASSERT (CBC_EXT_END == 121,
|
||||
JERRY_STATIC_ASSERT (CBC_EXT_END == 122,
|
||||
number_of_cbc_ext_opcodes_changed);
|
||||
|
||||
#if ENABLED (JERRY_PARSER)
|
||||
|
||||
@@ -736,6 +736,8 @@
|
||||
VM_OC_YIELD) \
|
||||
CBC_OPCODE (CBC_EXT_ASYNC_YIELD, CBC_NO_FLAG, 0, \
|
||||
VM_OC_ASYNC_YIELD) \
|
||||
CBC_OPCODE (CBC_EXT_ASYNC_YIELD_ITERATOR, CBC_NO_FLAG, 0, \
|
||||
VM_OC_ASYNC_YIELD_ITERATOR) \
|
||||
CBC_OPCODE (CBC_EXT_AWAIT, CBC_NO_FLAG, 0, \
|
||||
VM_OC_AWAIT) \
|
||||
CBC_OPCODE (CBC_EXT_GENERATOR_AWAIT, CBC_NO_FLAG, 0, \
|
||||
|
||||
@@ -1971,13 +1971,8 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
|
||||
if (context_p->token.type == LEXER_MULTIPLY)
|
||||
{
|
||||
lexer_next_token (context_p);
|
||||
opcode = CBC_EXT_YIELD_ITERATOR;
|
||||
|
||||
/* TODO: support yield * in async generator. Currently a meaningless error is thrown. */
|
||||
if (context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_INVALID_CHARACTER);
|
||||
}
|
||||
opcode = ((context_p->status_flags & PARSER_IS_ASYNC_FUNCTION) ? CBC_EXT_ASYNC_YIELD_ITERATOR
|
||||
: CBC_EXT_YIELD_ITERATOR);
|
||||
}
|
||||
|
||||
parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);
|
||||
|
||||
Reference in New Issue
Block a user