mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-22 11:41:38 +00:00
get the type right when accessing arrays in a struct (in a pointer?)
This is an imperfect revision of history.
This commit is contained in:
parent
56838844d2
commit
554f4d071a
1 changed files with 8 additions and 2 deletions
|
@ -2278,6 +2278,7 @@ address_expr (expr_t *e1, expr_t *e2, type_t *t)
|
||||||
return e2;
|
return e2;
|
||||||
if (e->type == ex_pointer && e2->type == ex_short) {
|
if (e->type == ex_pointer && e2->type == ex_short) {
|
||||||
e->e.pointer.val += e2->e.short_val;
|
e->e.pointer.val += e2->e.short_val;
|
||||||
|
e->e.pointer.type = t;
|
||||||
} else {
|
} else {
|
||||||
if (e2->type != ex_short || e2->e.short_val) {
|
if (e2->type != ex_short || e2->e.short_val) {
|
||||||
if (e->type == ex_expr && e->e.expr.op == '&') {
|
if (e->type == ex_expr && e->e.expr.op == '&') {
|
||||||
|
@ -2358,14 +2359,19 @@ assign_expr (expr_t *e1, expr_t *e2)
|
||||||
else
|
else
|
||||||
return error (e1, "invalid lvalue in assignment");
|
return error (e1, "invalid lvalue in assignment");
|
||||||
}
|
}
|
||||||
//XXX func = func ???
|
|
||||||
check_initialized (e2);
|
|
||||||
t1 = get_type (e1);
|
t1 = get_type (e1);
|
||||||
t2 = get_type (e2);
|
t2 = get_type (e2);
|
||||||
if (!t1 || !t2) {
|
if (!t1 || !t2) {
|
||||||
error (e1, "internal error");
|
error (e1, "internal error");
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
//XXX func = func ???
|
||||||
|
if (t1->type != ev_pointer || t2->type != ev_array)
|
||||||
|
check_initialized (e2);
|
||||||
|
else {
|
||||||
|
e2 = address_expr (e2, 0, t2->aux_type);
|
||||||
|
t2 = get_type (e2);
|
||||||
|
}
|
||||||
if (e2->type == ex_bool)
|
if (e2->type == ex_bool)
|
||||||
e2 = convert_from_bool (e2, t1);
|
e2 = convert_from_bool (e2, t1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue