Merge pull request #52911 from vnen/gdscript-use-getter-for-property-type

Use getter return type for the property type
This commit is contained in:
Rémi Verschelde 2021-10-08 07:45:42 +02:00 committed by GitHub
commit 89ed936ea1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)) {