Przeglądaj źródła

Merge pull request #52105 from ldmnt/master

Hugo Locurcio 4 lat temu
rodzic
commit
33773a24dc

+ 3 - 0
modules/gdscript/gdscript_parser.cpp

@@ -2365,6 +2365,9 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_assignment(ExpressionNode
 	}
 	assignment->assignee = p_previous_operand;
 	assignment->assigned_value = parse_expression(false);
+	if (assignment->assigned_value == nullptr) {
+		push_error(R"(Expected an expression after "=".)");
+	}
 
 #ifdef DEBUG_ENABLED
 	if (has_operator && source_variable != nullptr && source_variable->assignments == 0) {

+ 3 - 0
modules/gdscript/tests/scripts/parser/errors/assignment_empty_assignee.gd

@@ -0,0 +1,3 @@
+func test():
+	var a = 0
+	a =

+ 2 - 0
modules/gdscript/tests/scripts/parser/errors/assignment_empty_assignee.out

@@ -0,0 +1,2 @@
+GDTEST_PARSER_ERROR
+Expected an expression after "=".