mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-21 10:51:10 +00:00
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:
parent
22173df7bd
commit
336d91494f
1 changed files with 4 additions and 0 deletions
4
parser.c
4
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue