From 336d91494fd5c09226a21fdc2b54852f59dce27a Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sun, 25 Nov 2012 21:10:43 +0100 Subject: [PATCH] temporarily disable the 'constant' flag when parsing the initializer to avoid the 'assigning to constant' error in a block-local constant --- parser.c | 4 ++++ 1 file changed, 4 insertions(+) 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; } } -- 2.39.2