@@ -3684,12 +3684,12 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
3684
3684
case GDScriptParser::ClassNode::Member::GROUP:
3685
3685
return ERR_BUG;
3686
3686
case GDScriptParser::ClassNode::Member::CLASS: {
3687
- String type_name ;
3688
- String enum_name ;
3689
- GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (member.get_datatype ()), type_name, enum_name );
3687
+ String doc_type_name ;
3688
+ String doc_enum_name ;
3689
+ GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (member.get_datatype ()), doc_type_name, doc_enum_name );
3690
3690
3691
3691
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS;
3692
- r_result.class_name = type_name ;
3692
+ r_result.class_name = doc_type_name ;
3693
3693
} break ;
3694
3694
case GDScriptParser::ClassNode::Member::CONSTANT:
3695
3695
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT;
@@ -3712,11 +3712,11 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
3712
3712
}
3713
3713
3714
3714
if (member.type != GDScriptParser::ClassNode::Member::CLASS) {
3715
- String type_name ;
3716
- String enum_name ;
3717
- GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (base_type), type_name, enum_name );
3715
+ String doc_type_name ;
3716
+ String doc_enum_name ;
3717
+ GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (base_type), doc_type_name, doc_enum_name );
3718
3718
3719
- r_result.class_name = type_name ;
3719
+ r_result.class_name = doc_type_name ;
3720
3720
r_result.class_member = name;
3721
3721
}
3722
3722
@@ -3934,21 +3934,35 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
3934
3934
case GDScriptParser::DataType::ENUM: {
3935
3935
if (base_type.is_meta_type ) {
3936
3936
if (base_type.enum_values .has (p_symbol)) {
3937
- String type_name ;
3938
- String enum_name ;
3939
- GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (base_type), type_name, enum_name );
3937
+ String doc_type_name ;
3938
+ String doc_enum_name ;
3939
+ GDScriptDocGen::doctype_from_gdtype (GDScriptAnalyzer::type_from_metatype (base_type), doc_type_name, doc_enum_name );
3940
3940
3941
- if (CoreConstants::is_global_enum (enum_name )) {
3941
+ if (CoreConstants::is_global_enum (doc_enum_name )) {
3942
3942
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT;
3943
3943
r_result.class_name = " @GlobalScope" ;
3944
3944
r_result.class_member = p_symbol;
3945
3945
return OK;
3946
3946
} else {
3947
- const int dot_pos = enum_name .rfind_char (' .' );
3947
+ const int dot_pos = doc_enum_name .rfind_char (' .' );
3948
3948
if (dot_pos >= 0 ) {
3949
3949
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT;
3950
- r_result.class_name = enum_name .left (dot_pos);
3950
+ r_result.class_name = doc_enum_name .left (dot_pos);
3951
3951
r_result.class_member = p_symbol;
3952
+ if (base_type.class_type != nullptr ) {
3953
+ const String enum_name = doc_enum_name.substr (dot_pos + 1 );
3954
+ if (base_type.class_type ->has_member (enum_name)) {
3955
+ const GDScriptParser::ClassNode::Member member = base_type.class_type ->get_member (enum_name);
3956
+ if (member.type == GDScriptParser::ClassNode::Member::ENUM) {
3957
+ for (const GDScriptParser::EnumNode::Value &value : member.m_enum ->values ) {
3958
+ if (value.identifier ->name == p_symbol) {
3959
+ r_result.location = value.line ;
3960
+ break ;
3961
+ }
3962
+ }
3963
+ }
3964
+ }
3965
+ }
3952
3966
return OK;
3953
3967
}
3954
3968
}
0 commit comments