Merge pull request #70180 from rune-scape/enum-value-regression

Fix enum value regression
This commit is contained in:
Rémi Verschelde 2022-12-17 11:30:54 +01:00 committed by GitHub
commit 791e742af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -996,7 +996,9 @@ void GDScriptAnalyzer::resolve_class_member(GDScriptParser::ClassNode *p_class,
check_class_member_name_conflict(p_class, member.enum_value.identifier->name, member.enum_value.parent_enum); check_class_member_name_conflict(p_class, member.enum_value.identifier->name, member.enum_value.parent_enum);
if (member.enum_value.index > 0) { if (member.enum_value.index > 0) {
member.enum_value.value = member.enum_value.parent_enum->values[member.enum_value.index - 1].value + 1; const GDScriptParser::EnumNode::Value &prev_value = member.enum_value.parent_enum->values[member.enum_value.index - 1];
resolve_class_member(p_class, prev_value.identifier->name, member.enum_value.identifier);
member.enum_value.value = prev_value.value + 1;
} else { } else {
member.enum_value.value = 0; member.enum_value.value = 0;
} }

View File

@ -42,7 +42,8 @@ const c2 := EV2
enum { enum {
EV1 = 42, EV1 = 42,
EV2 = EV3 + 1 UNUSED = EV3,
EV2
} }
enum { enum {