diff options
author | rune-scape <allie.smith.epic@gmail.com> | 2022-12-04 05:35:41 -0500 |
---|---|---|
committer | rune-scape <allie.smith.epic@gmail.com> | 2022-12-04 05:36:17 -0500 |
commit | 6f8ffd55919876519044b131864331657a7e370b (patch) | |
tree | 7e4f4c327d0b855ab19b097b0a73387970969536 /modules | |
parent | 015dc492de33a41eaeb14c0503a6be10466fe457 (diff) |
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 663d72038d..3e836898eb 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(); |