You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
GDScript: Use getter return type for the property type
The PropertyInfo hints are more relevant for the inspector. The getter return type is more reliable and less likely to be incorrect and it is what's going to be called in the end.
This commit is contained in:
@@ -2608,10 +2608,13 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
|
||||
const StringName &native = base.native_type;
|
||||
|
||||
if (class_exists(native)) {
|
||||
PropertyInfo prop_info;
|
||||
MethodInfo method_info;
|
||||
if (ClassDB::get_property_info(native, name, &prop_info)) {
|
||||
p_identifier->set_datatype(type_from_property(prop_info));
|
||||
if (ClassDB::has_property(native, name)) {
|
||||
StringName getter_name = ClassDB::get_property_getter(native, name);
|
||||
MethodBind *getter = ClassDB::get_method(native, getter_name);
|
||||
if (getter != nullptr) {
|
||||
p_identifier->set_datatype(type_from_property(getter->get_return_info()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (ClassDB::get_method_info(native, name, &method_info)) {
|
||||
|
||||
Reference in New Issue
Block a user