mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-15 06:51:36 +00:00
Use labels in autogenerated enum value expressions
- For an enum like this: enum { value1 = SOME_NUM*2, value2 }; Generate an increment expression for value2 of the form (add (id value1) 1) and not (add (* SOME_NUM 2) 1)
This commit is contained in:
parent
af8e0f2ba6
commit
2a1414ad66
1 changed files with 6 additions and 1 deletions
|
@ -310,7 +310,12 @@ enum_def(X) ::= ENUM(T) IDENTIFIER(A) enum_type(B) LBRACE opt_enum_list(C) RBRAC
|
||||||
NEW_INTCONST_NODE(cval, TypeSInt32, 1, T);
|
NEW_INTCONST_NODE(cval, TypeSInt32, 1, T);
|
||||||
one = cval;
|
one = cval;
|
||||||
}
|
}
|
||||||
BINARY_EXPR(prev->Value, one, PEX_Add);
|
NEW_AST_NODE(ExprID, label, node);
|
||||||
|
label->Operation = PEX_ID;
|
||||||
|
label->Identifier = prev->Name;
|
||||||
|
label->Type = NULL;
|
||||||
|
|
||||||
|
BINARY_EXPR(label, one, PEX_Add);
|
||||||
node->Value = expr;
|
node->Value = expr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue