Implement yield* operation in generator functions. (#3407)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2019-12-05 13:50:53 +01:00
committed by Dániel Bátyai
parent 1829d2df55
commit 1a4972fc3f
13 changed files with 476 additions and 143 deletions
+9 -1
View File
@@ -1563,8 +1563,16 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
parser_check_assignment_expr (context_p);
lexer_next_token (context_p);
cbc_ext_opcode_t opcode = CBC_EXT_YIELD;
if (!lexer_check_yield_no_arg (context_p))
{
if (context_p->token.type == LEXER_MULTIPLY)
{
lexer_next_token (context_p);
opcode = CBC_EXT_YIELD_ITERATOR;
}
parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);
}
else
@@ -1572,7 +1580,7 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
parser_emit_cbc (context_p, CBC_PUSH_UNDEFINED);
}
parser_emit_cbc_ext (context_p, CBC_EXT_YIELD);
parser_emit_cbc_ext (context_p, opcode);
return (context_p->token.type != LEXER_RIGHT_PAREN
&& context_p->token.type != LEXER_COMMA);