summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-06-17 10:58:07 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-06-17 10:58:07 +0200
commit70a0bee7ede0e095cec8dccf5a1052c7597c3b20 (patch)
tree761707dc76a63f04a585f458e84b9c5cf004e839 /modules/gdscript/gdscript.cpp
parent0347130a59927054afb494d209a8175a53fcc7b9 (diff)
parentc419b548d2402cbbc863cc4bb08cf178b2a96c0d (diff)
downloadredot-engine-70a0bee7ede0e095cec8dccf5a1052c7597c3b20.tar.gz
Merge pull request #93166 from Hilderin/fix-binary-export-mismatched-external-parser
Fix mismatched external parser with binary exports
Diffstat (limited to 'modules/gdscript/gdscript.cpp')
-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);
+ }
}
}
}