From 2b96db5facec12a199e3d1ec89cb610ca5019718 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 25 Oct 2013 22:20:22 -0500 Subject: [PATCH] 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. --- src/zscript/zcc-parse.lemon | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/zscript/zcc-parse.lemon b/src/zscript/zcc-parse.lemon index ae31a1e096..8a8620a428 100644 --- a/src/zscript/zcc-parse.lemon +++ b/src/zscript/zcc-parse.lemon @@ -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;