mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Fix enum value lookup jump
This commit is contained in:
parent
f0f5319b0b
commit
d616ea5462
1 changed files with 18 additions and 3 deletions
|
@ -3956,10 +3956,14 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
|
|||
} else {
|
||||
const int dot_pos = doc_enum_name.rfind_char('.');
|
||||
if (dot_pos >= 0) {
|
||||
Error err = OK;
|
||||
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT;
|
||||
r_result.class_name = doc_enum_name.left(dot_pos);
|
||||
r_result.class_member = p_symbol;
|
||||
if (base_type.class_type != nullptr) {
|
||||
// For script enums the value isn't accessible as class constant so we need the full enum name.
|
||||
r_result.class_name = doc_enum_name;
|
||||
r_result.class_member = p_symbol;
|
||||
r_result.script = GDScriptCache::get_shallow_script(base_type.script_path, err);
|
||||
r_result.script_path = base_type.script_path;
|
||||
const String enum_name = doc_enum_name.substr(dot_pos + 1);
|
||||
if (base_type.class_type->has_member(enum_name)) {
|
||||
const GDScriptParser::ClassNode::Member member = base_type.class_type->get_member(enum_name);
|
||||
|
@ -3972,8 +3976,19 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (base_type.script_type.is_valid()) {
|
||||
// For script enums the value isn't accessible as class constant so we need the full enum name.
|
||||
r_result.class_name = doc_enum_name;
|
||||
r_result.class_member = p_symbol;
|
||||
r_result.script = base_type.script_type;
|
||||
r_result.script_path = base_type.script_path;
|
||||
// TODO: Find a way to obtain enum value location for a script
|
||||
r_result.location = base_type.script_type->get_member_line(doc_enum_name.substr(dot_pos + 1));
|
||||
} else {
|
||||
r_result.class_name = doc_enum_name.left(dot_pos);
|
||||
r_result.class_member = p_symbol;
|
||||
}
|
||||
return OK;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
} else if (Variant::has_builtin_method(Variant::DICTIONARY, p_symbol)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue