temporarily disable the 'constant' flag when parsing the initializer to avoid the 'assigning to constant' error in a block-local constant

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-25 21:10:43 +01:00
parent 22173df7bd
commit 336d91494f

View file

@ -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;
}
}