summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2020-07-24 13:45:23 -0300
committerGeorge Marques <george@gmarqu.es>2020-07-24 13:45:23 -0300
commite6b44b93c3ac3d93f80f5b28b903d57839d48e51 (patch)
treec4823f5ba28d189b9334f72b0650a4193bb4672e /modules/gdscript
parentb7dc08fcf6117bc13b0b1210119e51b4c51f5086 (diff)
GDScript: Allow "new()" to be called in non-static functions
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_compiler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp
index 3d37c7f803..e34d87f5cc 100644
--- a/modules/gdscript/gdscript_compiler.cpp
+++ b/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);