mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-06 00:41:13 +00:00
Simplify parse stage for unary - operator.
This commit is contained in:
parent
353455e1ad
commit
7249c2ec18
1 changed files with 8 additions and 8 deletions
4
parser.c
4
parser.c
|
@ -465,7 +465,8 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
|
||||||
out = exprs[0];
|
out = exprs[0];
|
||||||
break;
|
break;
|
||||||
case opid2('-','P'):
|
case opid2('-','P'):
|
||||||
if (!(out = fold_op(parser->fold, op, exprs))) {
|
if ((out = fold_op(parser->fold, op, exprs)))
|
||||||
|
break;
|
||||||
if (exprs[0]->vtype != TYPE_FLOAT &&
|
if (exprs[0]->vtype != TYPE_FLOAT &&
|
||||||
exprs[0]->vtype != TYPE_VECTOR) {
|
exprs[0]->vtype != TYPE_VECTOR) {
|
||||||
compile_error(ctx, "invalid types used in unary expression: cannot negate type %s",
|
compile_error(ctx, "invalid types used in unary expression: cannot negate type %s",
|
||||||
|
@ -473,7 +474,6 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
out = (ast_expression*)ast_unary_new(ctx, (VINSTR_NEG_F-TYPE_FLOAT) + exprs[0]->vtype, exprs[0]);
|
out = (ast_expression*)ast_unary_new(ctx, (VINSTR_NEG_F-TYPE_FLOAT) + exprs[0]->vtype, exprs[0]);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case opid2('!','P'):
|
case opid2('!','P'):
|
||||||
|
|
Loading…
Reference in a new issue