From: Wolfgang (Blub) Bumiller Date: Sun, 25 Nov 2012 20:10:43 +0000 (+0100) Subject: temporarily disable the 'constant' flag when parsing the initializer to avoid the... X-Git-Tag: 0.1.9~237 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=336d91494fd5c09226a21fdc2b54852f59dce27a temporarily disable the 'constant' flag when parsing the initializer to avoid the 'assigning to constant' error in a block-local constant --- diff --git a/parser.c b/parser.c index 0bedff2..945ddbf 100644 --- a/parser.c +++ b/parser.c @@ -3879,7 +3879,10 @@ skipvar: ast_unref(cval); } } else { + bool cvq; shunt sy = { NULL, NULL }; + cvq = var->constant; + var->constant = false; vec_push(sy.out, syexp(ast_ctx(var), (ast_expression*)var)); vec_push(sy.out, syexp(ast_ctx(cexp), (ast_expression*)cexp)); vec_push(sy.ops, syop(ast_ctx(var), parser->assign_op)); @@ -3892,6 +3895,7 @@ skipvar: } vec_free(sy.out); vec_free(sy.ops); + var->constant = cvq; } }