summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-08-18 23:18:40 +0200
committerGitHub <noreply@github.com>2020-08-18 23:18:40 +0200
commite2fb55471c0bdd4f25ed6448e5e8eff99882afa8 (patch)
tree74976c55f9165fddb01ae52b587e3578f52a54d7 /modules/gdscript/gdscript.cpp
parent65730ab9f6fbae34bb161113161b43f8b3fcd4d2 (diff)
parent35176247af80626684ff6bb1a1eb3bc031857b1c (diff)
Merge pull request #41359 from vnen/gdscript-2-fixes
Assorted fixes for GDScript bugs
Diffstat (limited to 'modules/gdscript/gdscript.cpp')
-rw-r--r--modules/gdscript/gdscript.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 9170255c02..541d46a2af 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -596,6 +596,21 @@ Error GDScript::reload(bool p_keep_state) {
return OK;
}
+ {
+ String source_path = path;
+ if (source_path.empty()) {
+ source_path = get_path();
+ }
+ if (!source_path.empty()) {
+ MutexLock lock(GDScriptCache::singleton->lock);
+ Ref<GDScript> self(this);
+ if (!GDScriptCache::singleton->shallow_gdscript_cache.has(source_path)) {
+ GDScriptCache::singleton->shallow_gdscript_cache[source_path] = self;
+ self->unreference();
+ }
+ }
+ }
+
valid = false;
GDScriptParser parser;
Error err = parser.parse(source, path, false);