@@ -3694,12 +3694,12 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
3694
3694
case GDScriptParser::ClassNode::Member::GROUP:
3695
3695
return ERR_BUG;
3696
3696
case GDScriptParser::ClassNode::Member::CLASS: {
3697
- String type_name ;
3698
- String enum_name ;
3699
- GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (member.get_datatype ()), type_name, enum_name );
3697
+ String doc_type_name ;
3698
+ String doc_enum_name ;
3699
+ GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (member.get_datatype ()), doc_type_name, doc_enum_name );
3700
3700
3701
3701
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS;
3702
- r_result.class_name = type_name ;
3702
+ r_result.class_name = doc_type_name ;
3703
3703
} break ;
3704
3704
case GDScriptParser::ClassNode::Member::CONSTANT:
3705
3705
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT;
@@ -3722,11 +3722,11 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
3722
3722
}
3723
3723
3724
3724
if (member.type != GDScriptParser::ClassNode::Member::CLASS) {
3725
- String type_name ;
3726
- String enum_name ;
3727
- GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (base_type), type_name, enum_name );
3725
+ String doc_type_name ;
3726
+ String doc_enum_name ;
3727
+ GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (base_type), doc_type_name, doc_enum_name );
3728
3728
3729
- r_result.class_name = type_name ;
3729
+ r_result.class_name = doc_type_name ;
3730
3730
r_result.class_member = name;
3731
3731
}
3732
3732
@@ -3944,21 +3944,35 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
3944
3944
case GDScriptParser::DataType::ENUM: {
3945
3945
if (base_type.is_meta_type ) {
3946
3946
if (base_type.enum_values .has (p_symbol)) {
3947
- String type_name ;
3948
- String enum_name ;
3949
- GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (base_type), type_name, enum_name );
3947
+ String doc_type_name ;
3948
+ String doc_enum_name ;
3949
+ GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (base_type), doc_type_name, doc_enum_name );
3950
3950
3951
- if (CoreConstants::is_global_enum (enum_name )) {
3951
+ if (CoreConstants::is_global_enum (doc_enum_name )) {
3952
3952
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT;
3953
3953
r_result.class_name = " @GlobalScope" ;
3954
3954
r_result.class_member = p_symbol;
3955
3955
return OK;
3956
3956
} else {
3957
- const int dot_pos = enum_name .rfind_char (' .' );
3957
+ const int dot_pos = doc_enum_name .rfind_char (' .' );
3958
3958
if (dot_pos >= 0 ) {
3959
3959
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT;
3960
- r_result.class_name = enum_name .left (dot_pos);
3960
+ r_result.class_name = doc_enum_name .left (dot_pos);
3961
3961
r_result.class_member = p_symbol;
3962
+ if (base_type.class_type != nullptr ) {
3963
+ const String enum_name = doc_enum_name.substr (dot_pos + 1 );
3964
+ if (base_type.class_type ->has_member (enum_name)) {
3965
+ const GDScriptParser::ClassNode::Member member = base_type.class_type ->get_member (enum_name);
3966
+ if (member.type == GDScriptParser::ClassNode::Member::ENUM) {
3967
+ for (const GDScriptParser::EnumNode::Value &value : member.m_enum ->values ) {
3968
+ if (value.identifier ->name == p_symbol) {
3969
+ r_result.location = value.line ;
3970
+ break ;
3971
+ }
3972
+ }
3973
+ }
3974
+ }
3975
+ }
3962
3976
return OK;
3963
3977
}
3964
3978
}
0 commit comments