diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-12-10 11:29:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-10 11:29:50 +0100 |
commit | 1ac7e5a3343ef9f4ecc7c494f7212b7c718520c8 (patch) | |
tree | 3ef7bec9b8bf4cd31391f84fe18b2a035adf94a7 /modules | |
parent | 0c1273629df7941a909716454408ebffb791c1a0 (diff) | |
parent | 6f8ffd55919876519044b131864331657a7e370b (diff) |
Merge pull request #69518 from rune-scape/rune-analyze-values
GDScript: Preload should make native type
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript_analyzer.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 85929ae6c5..0c86bce2ce 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/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(); |