mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-12 07:34:50 +00:00
Do not share constant 1 for enum autoincrements.
- AST nodes cannot be shared, because type conversion changes them in place, and what's appropriate for one use is by no means appropriate for all uses.
This commit is contained in:
parent
6384613487
commit
2b96db5fac
1 changed files with 1 additions and 6 deletions
|
@ -280,7 +280,6 @@ enum_def(X) ::= ENUM(T) IDENTIFIER(A) enum_type(B) LBRACE opt_enum_list(C) RBRAC
|
|||
if (C != NULL)
|
||||
{
|
||||
ZCC_ConstantDef *node = C, *prev = node;
|
||||
ZCC_ExprConstant *one = NULL;
|
||||
|
||||
if (node->Value == NULL)
|
||||
{
|
||||
|
@ -308,11 +307,7 @@ enum_def(X) ::= ENUM(T) IDENTIFIER(A) enum_type(B) LBRACE opt_enum_list(C) RBRAC
|
|||
// Otherwise, create a new addition expression to add 1.
|
||||
else
|
||||
{
|
||||
if (one == NULL)
|
||||
{ // Use a single 1 node for the right-hand side of the addition.
|
||||
NEW_INTCONST_NODE(cval, TypeSInt32, 1, T);
|
||||
one = cval;
|
||||
}
|
||||
NEW_INTCONST_NODE(one, TypeSInt32, 1, T);
|
||||
NEW_AST_NODE(ExprID, label, node);
|
||||
label->Operation = PEX_ID;
|
||||
label->Identifier = prev->Name;
|
||||
|
|
Loading…
Reference in a new issue