summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHilderin <81109165+Hilderin@users.noreply.github.com>2024-06-14 11:18:52 -0400
committerHilderin <81109165+Hilderin@users.noreply.github.com>2024-06-14 11:18:52 -0400
commitc419b548d2402cbbc863cc4bb08cf178b2a96c0d (patch)
tree850ee7639a31005ad00c5fadc7c07818cdf75dab
parent4119fb32cb8b3213bc38886fe4c381db4fe5f24e (diff)
downloadredot-engine-c419b548d2402cbbc863cc4bb08cf178b2a96c0d.tar.gz
Fix mismatched external parser with binary exports
-rw-r--r--modules/gdscript/gdscript.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 0c58b41fcb..838ab42beb 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -771,8 +771,16 @@ Error GDScript::reload(bool p_keep_state) {
if (GDScriptCache::has_parser(source_path)) {
Error err = OK;
Ref<GDScriptParserRef> parser_ref = GDScriptCache::get_parser(source_path, GDScriptParserRef::EMPTY, err);
- if (parser_ref.is_valid() && parser_ref->get_source_hash() != source.hash()) {
- GDScriptCache::remove_parser(source_path);
+ if (parser_ref.is_valid()) {
+ uint32_t source_hash;
+ if (!binary_tokens.is_empty()) {
+ source_hash = hash_djb2_buffer(binary_tokens.ptr(), binary_tokens.size());
+ } else {
+ source_hash = source.hash();
+ }
+ if (parser_ref->get_source_hash() != source_hash) {
+ GDScriptCache::remove_parser(source_path);
+ }
}
}
}