mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-24 04:41:25 +00:00
assignment to constant error
This commit is contained in:
parent
39f572fe99
commit
353b1f945f
1 changed files with 21 additions and 0 deletions
21
parser.c
21
parser.c
|
@ -940,6 +940,9 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy)
|
||||||
parseerror(parser, "invalid types in assignment: cannot assign %s to %s", ty2, ty1);
|
parseerror(parser, "invalid types in assignment: cannot assign %s to %s", ty2, ty1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ast_istype(exprs[0], ast_value) && asvalue[0]->constant) {
|
||||||
|
parseerror(parser, "assignment to constant `%s`", asvalue[0]->name);
|
||||||
|
}
|
||||||
out = (ast_expression*)ast_store_new(ctx, assignop, exprs[0], exprs[1]);
|
out = (ast_expression*)ast_store_new(ctx, assignop, exprs[0], exprs[1]);
|
||||||
break;
|
break;
|
||||||
case opid3('+','+','P'):
|
case opid3('+','+','P'):
|
||||||
|
@ -954,6 +957,9 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy)
|
||||||
addop = INSTR_ADD_F;
|
addop = INSTR_ADD_F;
|
||||||
else
|
else
|
||||||
addop = INSTR_SUB_F;
|
addop = INSTR_SUB_F;
|
||||||
|
if (ast_istype(exprs[0], ast_value) && asvalue[0]->constant) {
|
||||||
|
parseerror(parser, "assignment to constant `%s`", asvalue[0]->name);
|
||||||
|
}
|
||||||
if (ast_istype(exprs[0], ast_entfield)) {
|
if (ast_istype(exprs[0], ast_entfield)) {
|
||||||
out = (ast_expression*)ast_binstore_new(ctx, INSTR_STOREP_F, addop,
|
out = (ast_expression*)ast_binstore_new(ctx, INSTR_STOREP_F, addop,
|
||||||
exprs[0],
|
exprs[0],
|
||||||
|
@ -979,6 +985,9 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy)
|
||||||
addop = INSTR_SUB_F;
|
addop = INSTR_SUB_F;
|
||||||
subop = INSTR_ADD_F;
|
subop = INSTR_ADD_F;
|
||||||
}
|
}
|
||||||
|
if (ast_istype(exprs[0], ast_value) && asvalue[0]->constant) {
|
||||||
|
parseerror(parser, "assignment to constant `%s`", asvalue[0]->name);
|
||||||
|
}
|
||||||
if (ast_istype(exprs[0], ast_entfield)) {
|
if (ast_istype(exprs[0], ast_entfield)) {
|
||||||
out = (ast_expression*)ast_binstore_new(ctx, INSTR_STOREP_F, addop,
|
out = (ast_expression*)ast_binstore_new(ctx, INSTR_STOREP_F, addop,
|
||||||
exprs[0],
|
exprs[0],
|
||||||
|
@ -1005,6 +1014,9 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy)
|
||||||
ty1, ty2);
|
ty1, ty2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (ast_istype(exprs[0], ast_value) && asvalue[0]->constant) {
|
||||||
|
parseerror(parser, "assignment to constant `%s`", asvalue[0]->name);
|
||||||
|
}
|
||||||
if (ast_istype(exprs[0], ast_entfield))
|
if (ast_istype(exprs[0], ast_entfield))
|
||||||
assignop = type_storep_instr[exprs[0]->expression.vtype];
|
assignop = type_storep_instr[exprs[0]->expression.vtype];
|
||||||
else
|
else
|
||||||
|
@ -1039,6 +1051,9 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy)
|
||||||
ty1, ty2);
|
ty1, ty2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (ast_istype(exprs[0], ast_value) && asvalue[0]->constant) {
|
||||||
|
parseerror(parser, "assignment to constant `%s`", asvalue[0]->name);
|
||||||
|
}
|
||||||
if (ast_istype(exprs[0], ast_entfield))
|
if (ast_istype(exprs[0], ast_entfield))
|
||||||
assignop = type_storep_instr[exprs[0]->expression.vtype];
|
assignop = type_storep_instr[exprs[0]->expression.vtype];
|
||||||
else
|
else
|
||||||
|
@ -1080,6 +1095,9 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy)
|
||||||
ty1, ty2);
|
ty1, ty2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (ast_istype(exprs[0], ast_value) && asvalue[0]->constant) {
|
||||||
|
parseerror(parser, "assignment to constant `%s`", asvalue[0]->name);
|
||||||
|
}
|
||||||
if (ast_istype(exprs[0], ast_entfield))
|
if (ast_istype(exprs[0], ast_entfield))
|
||||||
assignop = type_storep_instr[exprs[0]->expression.vtype];
|
assignop = type_storep_instr[exprs[0]->expression.vtype];
|
||||||
else
|
else
|
||||||
|
@ -1107,6 +1125,9 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy)
|
||||||
out = (ast_expression*)ast_binary_new(ctx, INSTR_BITAND, exprs[0], exprs[1]);
|
out = (ast_expression*)ast_binary_new(ctx, INSTR_BITAND, exprs[0], exprs[1]);
|
||||||
if (!out)
|
if (!out)
|
||||||
return false;
|
return false;
|
||||||
|
if (ast_istype(exprs[0], ast_value) && asvalue[0]->constant) {
|
||||||
|
parseerror(parser, "assignment to constant `%s`", asvalue[0]->name);
|
||||||
|
}
|
||||||
out = (ast_expression*)ast_binstore_new(ctx, assignop, INSTR_SUB_F, exprs[0], out);
|
out = (ast_expression*)ast_binstore_new(ctx, assignop, INSTR_SUB_F, exprs[0], out);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue