Fix symbol lookup for native enums
This commit is contained in:
parent
25ff1306d6
commit
322c64c6ea
1 changed files with 23 additions and 4 deletions
|
@ -3657,11 +3657,21 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringName enum_name = ClassDB::get_integer_constant_enum(class_name, p_symbol, true);
|
List<StringName> enums;
|
||||||
if (enum_name != StringName()) {
|
ClassDB::get_enum_list(class_name, &enums);
|
||||||
|
for (const StringName &E : enums) {
|
||||||
|
if (E == p_symbol) {
|
||||||
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_ENUM;
|
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_ENUM;
|
||||||
r_result.class_name = base_type.native_type;
|
r_result.class_name = base_type.native_type;
|
||||||
r_result.class_member = enum_name;
|
r_result.class_member = p_symbol;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String(ClassDB::get_integer_constant_enum(class_name, p_symbol, true)).is_empty()) {
|
||||||
|
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT;
|
||||||
|
r_result.class_name = base_type.native_type;
|
||||||
|
r_result.class_member = p_symbol;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3735,6 +3745,15 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case GDScriptParser::DataType::ENUM: {
|
||||||
|
if (base_type.enum_values.has(p_symbol)) {
|
||||||
|
r_result.type = ScriptLanguage::LOOKUP_RESULT_CLASS_CONSTANT;
|
||||||
|
r_result.class_name = String(base_type.native_type).get_slicec('.', 0);
|
||||||
|
r_result.class_member = p_symbol;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
base_type.kind = GDScriptParser::DataType::UNRESOLVED;
|
||||||
|
} break;
|
||||||
default: {
|
default: {
|
||||||
base_type.kind = GDScriptParser::DataType::UNRESOLVED;
|
base_type.kind = GDScriptParser::DataType::UNRESOLVED;
|
||||||
} break;
|
} break;
|
||||||
|
|
Loading…
Reference in a new issue