summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorJ08nY <johny@neuromancer.sk>2018-10-10 00:50:47 +0200
committerJ08nY <johny@neuromancer.sk>2018-10-11 22:52:56 +0200
commit6e8f0cfdc6ed71b51a882ca910a7efea1600b3c9 (patch)
tree29e65f9e24a2c05b018fe76a36541e5c623adb89 /modules/gdscript
parent4c1a5d9cfe2da761bfe17d52126deabc1f1c1bd3 (diff)
Do not make a function that returns Variant::NIL a void function. Fix #22791.
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript_parser.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 5f2655eb92..97ac6f7de6 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -6709,9 +6709,15 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
}
}
+ bool rets = false;
return_type.has_type = true;
return_type.kind = DataType::BUILTIN;
- return_type.builtin_type = Variant::get_method_return_type(base_type.builtin_type, callee_name);
+ return_type.builtin_type = Variant::get_method_return_type(base_type.builtin_type, callee_name, &rets);
+ // If the method returns, but it might return any type, (Variant::NIL), pretend we don't know the type.
+ // At least make sure we know that it returns
+ if (rets && return_type.builtin_type == Variant::NIL) {
+ return_type.has_type = false;
+ }
break;
}