Fix unnammed enum crash regression

This commit is contained in:
ocean (they/them) 2023-01-18 09:12:27 -05:00
parent e514e3732a
commit 4854e723be
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