Merge pull request #52085 from williamd67/fix-await-without-argument

Print error message when await is not followed by signal or coroutine
This commit is contained in:
Hugo Locurcio 2021-08-28 23:01:34 +02:00 committed by GitHub
commit 4f9509e6ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2380,7 +2380,11 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_assignment(ExpressionNode
GDScriptParser::ExpressionNode *GDScriptParser::parse_await(ExpressionNode *p_previous_operand, bool p_can_assign) {
AwaitNode *await = alloc_node<AwaitNode>();
await->to_await = parse_precedence(PREC_AWAIT, false);
ExpressionNode *element = parse_precedence(PREC_AWAIT, false);
if (element == nullptr) {
push_error(R"(Expected signal or coroutine after "await".)");
}
await->to_await = element;
current_function->is_coroutine = true;