[GDScript] Add static HashMap cleanup.

This commit is contained in:
bruvzg 2020-08-01 22:00:26 +03:00
parent ec9302cecc
commit ee973f5b90
No known key found for this signature in database
GPG Key ID: FCED35F1CECE0D3A
5 changed files with 15 additions and 0 deletions

View File

@ -71,6 +71,10 @@ static StringName get_real_class_name(const StringName &p_source) {
return p_source;
}
void GDScriptAnalyzer::cleanup() {
underscore_map.clear();
}
static GDScriptParser::DataType make_callable_type(const MethodInfo &p_info) {
GDScriptParser::DataType type;
type.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT;

View File

@ -113,6 +113,8 @@ public:
Error analyze();
GDScriptAnalyzer(GDScriptParser *p_parser);
static void cleanup();
};
#endif // GDSCRIPT_ANALYZER_H

View File

@ -94,6 +94,10 @@ Variant::Type GDScriptParser::get_builtin_type(const StringName &p_type) {
return Variant::VARIANT_MAX;
}
void GDScriptParser::cleanup() {
builtin_types.clear();
}
GDScriptFunctions::Function GDScriptParser::get_builtin_function(const StringName &p_name) {
for (int i = 0; i < GDScriptFunctions::FUNC_MAX; i++) {
if (p_name == GDScriptFunctions::get_func_name(GDScriptFunctions::Function(i))) {

View File

@ -1335,6 +1335,7 @@ public:
void print_tree(const GDScriptParser &p_parser);
};
#endif // DEBUG_ENABLED
static void cleanup();
};
#endif // GDSCRIPT_PARSER_H

View File

@ -35,6 +35,7 @@
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "gdscript.h"
#include "gdscript_analyzer.h"
#include "gdscript_cache.h"
#include "gdscript_tokenizer.h"
@ -148,4 +149,7 @@ void unregister_gdscript_types() {
EditorTranslationParser::get_singleton()->remove_parser(gdscript_translation_parser_plugin, EditorTranslationParser::STANDARD);
gdscript_translation_parser_plugin.unref();
#endif // TOOLS_ENABLED
GDScriptParser::cleanup();
GDScriptAnalyzer::cleanup();
}