GDScript: Show error on invalid initializer expression
This commit is contained in:
parent
577a17980d
commit
3e4ecd9669
1 changed files with 3 additions and 0 deletions
|
@ -844,6 +844,9 @@ GDScriptParser::VariableNode *GDScriptParser::parse_variable(bool p_allow_proper
|
|||
if (match(GDScriptTokenizer::Token::EQUAL)) {
|
||||
// Initializer.
|
||||
variable->initializer = parse_expression(false);
|
||||
if (variable->initializer == nullptr) {
|
||||
push_error(R"(Expected expression for variable initial value after "=".)");
|
||||
}
|
||||
variable->assignments++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue