mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Fix assignment sub-expressions.
This commit is contained in:
parent
6fa5bbe473
commit
d2b464053c
1 changed files with 10 additions and 2 deletions
|
@ -274,7 +274,7 @@ statement_branch (sblock_t *sblock, expr_t *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
static sblock_t *
|
static sblock_t *
|
||||||
statement_assign (sblock_t *sblock, expr_t *e)
|
expr_assign (sblock_t *sblock, expr_t *e, operand_t **op)
|
||||||
{
|
{
|
||||||
statement_t *s;
|
statement_t *s;
|
||||||
expr_t *src_expr = e->e.expr.e2;
|
expr_t *src_expr = e->e.expr.e2;
|
||||||
|
@ -288,6 +288,8 @@ statement_assign (sblock_t *sblock, expr_t *e)
|
||||||
sblock = statement_subexpr (sblock, dst_expr, &dst);
|
sblock = statement_subexpr (sblock, dst_expr, &dst);
|
||||||
sblock = statement_subexpr (sblock, src_expr, &src);
|
sblock = statement_subexpr (sblock, src_expr, &src);
|
||||||
ofs = 0;
|
ofs = 0;
|
||||||
|
if (op)
|
||||||
|
*op = dst;
|
||||||
} else {
|
} else {
|
||||||
//FIXME this sucks. find a better way to handle both pointer
|
//FIXME this sucks. find a better way to handle both pointer
|
||||||
//dereferences and pointer assignements
|
//dereferences and pointer assignements
|
||||||
|
@ -306,6 +308,8 @@ statement_assign (sblock_t *sblock, expr_t *e)
|
||||||
sblock = statement_subexpr (sblock, dst_expr, &dst);
|
sblock = statement_subexpr (sblock, dst_expr, &dst);
|
||||||
ofs = 0;
|
ofs = 0;
|
||||||
}
|
}
|
||||||
|
if (op)
|
||||||
|
*op = src;
|
||||||
}
|
}
|
||||||
s = new_statement (opcode);
|
s = new_statement (opcode);
|
||||||
s->opa = src;
|
s->opa = src;
|
||||||
|
@ -446,6 +450,10 @@ expr_expr (sblock_t *sblock, expr_t *e, operand_t **op)
|
||||||
case 'c':
|
case 'c':
|
||||||
sblock = expr_call (sblock, e, op);
|
sblock = expr_call (sblock, e, op);
|
||||||
break;
|
break;
|
||||||
|
case '=':
|
||||||
|
case PAS:
|
||||||
|
sblock = expr_assign (sblock, e, op);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
opcode = convert_op (e->e.expr.op);
|
opcode = convert_op (e->e.expr.op);
|
||||||
if (!opcode)
|
if (!opcode)
|
||||||
|
@ -731,7 +739,7 @@ statement_expr (sblock_t *sblock, expr_t *e)
|
||||||
break;
|
break;
|
||||||
case '=':
|
case '=':
|
||||||
case PAS:
|
case PAS:
|
||||||
sblock = statement_assign (sblock, e);
|
sblock = expr_assign (sblock, e, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (e->e.expr.op < 256)
|
if (e->e.expr.op < 256)
|
||||||
|
|
Loading…
Reference in a new issue