Forráskód Böngészése

GDScript: preload should make native type

rune-scape 2 éve
szülő
commit
6f8ffd5591
1 módosított fájl, 7 hozzáadás és 1 törlés
  1. 7 1
      modules/gdscript/gdscript_analyzer.cpp

+ 7 - 1
modules/gdscript/gdscript_analyzer.cpp

@@ -3714,7 +3714,13 @@ GDScriptParser::DataType GDScriptAnalyzer::type_from_variant(const Variant &p_va
 	result.builtin_type = p_value.get_type();
 	result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT; // Constant has explicit type.
 
-	if (p_value.get_type() == Variant::OBJECT) {
+	if (p_value.get_type() == Variant::NIL) {
+		// A null value is a variant, not void.
+		result.kind = GDScriptParser::DataType::VARIANT;
+	} else if (p_value.get_type() == Variant::OBJECT) {
+		// Object is treated as a native type, not a builtin type.
+		result.kind = GDScriptParser::DataType::NATIVE;
+
 		Object *obj = p_value;
 		if (!obj) {
 			return GDScriptParser::DataType();