GDScript: Fix STANDALONE_EXPRESSION warning for preload()

This commit is contained in:
Danil Alexeev committed 2024-05-17 10:33:01 +03:00
1 parent 5708a3a02e
commit 7dd801c580
8 files changed
+30 -7

No files matched your search

+4
View File
@@ -1877,6 +1877,10 @@ GDScriptParser::Node *GDScriptParser::parse_statement() {
case Node::CALL:
// Fine.
break;
case Node::PRELOAD:
// `preload` is a function-like keyword.
push_warning(expression, GDScriptWarning::RETURN_VALUE_DISCARDED, "preload");
break;
case Node::LAMBDA:
// Standalone lambdas can't be used, so make this an error.
push_error("Standalone lambdas cannot be accessed. Consider assigning it to a variable.", expression);