Quellcode durchsuchen

Merge pull request #40698 from vnen/gscript-allow-new-call

Allow "new()" to be called in non-static functions
Rémi Verschelde vor 5 Jahren
Ursprung
Commit
58bde149cc
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      modules/gdscript/gdscript_compiler.cpp

+ 1 - 1
modules/gdscript/gdscript_compiler.cpp

@@ -736,7 +736,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
 				} else {
 					if (callee->type == GDScriptParser::Node::IDENTIFIER) {
 						// Self function call.
-						if (codegen.function_node && codegen.function_node->is_static) {
+						if ((codegen.function_node && codegen.function_node->is_static) || call->function_name == "new") {
 							ret = (GDScriptFunction::ADDR_TYPE_CLASS << GDScriptFunction::ADDR_BITS);
 						} else {
 							ret = (GDScriptFunction::ADDR_TYPE_SELF << GDScriptFunction::ADDR_BITS);