diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 07dbb2ac26..5007a43385 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -5779,6 +5779,37 @@ GDScriptParser::DataType GDScriptAnalyzer::type_from_metatype(const GDScriptPars return result; } +GDScriptParser::DataType GDScriptAnalyzer::type_from_property_hint_string(const String &p_type_name) const { + GDScriptParser::DataType result; + result.type_source = GDScriptParser::DataType::ANNOTATED_EXPLICIT; + result.is_constant = false; + + const Variant::Type builtin_type = GDScriptParser::get_builtin_type(p_type_name); + if (builtin_type < Variant::VARIANT_MAX) { + // Built-in type. + result.kind = GDScriptParser::DataType::BUILTIN; + result.builtin_type = builtin_type; + } else if (class_exists(p_type_name)) { + result.kind = GDScriptParser::DataType::NATIVE; + result.builtin_type = Variant::OBJECT; + result.native_type = p_type_name; + } else if (ScriptServer::is_global_class(p_type_name)) { + // Just load this as it shouldn't be a GDScript. + Ref