Merge pull request #71624 from anvilfolk/enum-regression

Fix unnammed enum crash regression
This commit is contained in:
Rémi Verschelde 2023-01-18 17:34:29 +01:00
commit 3f10f9f5ef
No known key found for this signature in database
GPG key ID: C3336907360768E1
3 changed files with 9 additions and 1 deletions

View file

@ -3171,7 +3171,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
for (int i = 0; i < current_enum->values.size(); i++) {
const GDScriptParser::EnumNode::Value &element = current_enum->values[i];
if (element.identifier->name == p_identifier->name) {
StringName enum_name = current_enum->identifier->name ? current_enum->identifier->name : UNNAMED_ENUM;
StringName enum_name = current_enum->identifier ? current_enum->identifier->name : UNNAMED_ENUM;
GDScriptParser::DataType type = make_enum_type(enum_name, parser->current_class->fqcn, false);
if (element.parent_enum->identifier) {
type.enum_type = element.parent_enum->identifier->name;

View file

@ -0,0 +1,7 @@
enum {
V1,
V2 = V1,
}
func test():
pass

View file

@ -0,0 +1 @@
GDTEST_OK