diff options
author | George Marques <george@gmarqu.es> | 2022-06-17 14:48:07 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2022-06-24 14:48:46 -0300 |
commit | 81cac4907fb605e4a55712c0a835b7e83660bc04 (patch) | |
tree | 2aa1fd3c74861dd75c6862b4a0339e7e8ddcfbda /modules | |
parent | 307dfa9fe960c93b3f4c2f78d9c046c1ffff6a93 (diff) |
GDScript: Don't add implicit constructor to the list of functions
So it's not shown on docs or when listing the methods. This also avoids
being able to call it using the `call()` function.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/gdscript_compiler.cpp | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 617db883f8..874e0f22c5 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1254,6 +1254,10 @@ GDScript::~GDScript() { memdelete(E.value); } + if (implicit_initializer) { + memdelete(implicit_initializer); + } + if (GDScriptCache::singleton) { // Cache may have been already destroyed at engine shutdown. GDScriptCache::remove_script(get_path()); } diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 25454030b1..ca4995152e 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -2140,7 +2140,7 @@ GDScriptFunction *GDScriptCompiler::_parse_function(Error &r_error, GDScript *p_ #endif } - if (!p_for_lambda) { + if (!is_implicit_initializer && !p_for_lambda) { p_script->member_functions[func_name] = gd_function; } @@ -2208,11 +2208,15 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar for (const KeyValue<StringName, GDScriptFunction *> &E : p_script->member_functions) { memdelete(E.value); } + if (p_script->implicit_initializer) { + memdelete(p_script->implicit_initializer); + } p_script->member_functions.clear(); p_script->member_indices.clear(); p_script->member_info.clear(); p_script->_signals.clear(); p_script->initializer = nullptr; + p_script->implicit_initializer = nullptr; p_script->tool = parser->is_tool(); p_script->name = p_class->identifier ? p_class->identifier->name : ""; |