Răsfoiți Sursa

Fix mismatched external parser with binary exports

Hilderin 1 an în urmă
părinte
comite
c419b548d2
1 a modificat fișierele cu 10 adăugiri și 2 ștergeri
  1. 10 2
      modules/gdscript/gdscript.cpp

+ 10 - 2
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);
+					}
 				}
 			}
 		}