1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Merge pull request #69518 from rune-scape/rune-analyze-values

GDScript: Preload should make native type
This commit is contained in:
Rémi Verschelde
2022-12-10 11:29:50 +01:00
committed by GitHub

View File

@@ -3714,7 +3714,13 @@ GDScriptParser::DataType GDScriptAnalyzer::type_from_variant(const Variant &p_va
result.builtin_type = p_value.get_type(); result.builtin_type = p_value.get_type();
result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT; // Constant has explicit 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; Object *obj = p_value;
if (!obj) { if (!obj) {
return GDScriptParser::DataType(); return GDScriptParser::DataType();