GDScript: Fix STANDALONE_EXPRESSION warning for preload()

This commit is contained in:
Danil Alexeev 2024-05-16 22:11:56 +03:00
parent 5708a3a02e
commit 7dd801c580
No known key found for this signature in database
GPG key ID: 124453E157DA8DC7
8 changed files with 30 additions and 7 deletions

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);