mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Resurrect the address expression code for arrays etc.
This fixes selector finding.
This commit is contained in:
parent
c542e1a453
commit
eff3957487
1 changed files with 18 additions and 2 deletions
|
@ -1863,8 +1863,24 @@ address_expr (expr_t *e1, expr_t *e2, type_t *t)
|
|||
switch (e1->type) {
|
||||
case ex_symbol:
|
||||
if (e1->e.symbol->sy_type == sy_var) {
|
||||
e = new_unary_expr ('&', e1);
|
||||
e->e.expr.type = pointer_type (t);
|
||||
def_t *def = e1->e.symbol->s.def;
|
||||
type_t *type = def->type;
|
||||
|
||||
if (is_struct (type) || is_class (type)) {
|
||||
e = new_pointer_expr (0, t, def);
|
||||
e->line = e1->line;
|
||||
e->file = e1->file;
|
||||
} else if (is_array (type)) {
|
||||
e = e1;
|
||||
e->type = ex_value;
|
||||
e->e.value.type = ev_pointer;
|
||||
e->e.value.v.pointer.val = 0;
|
||||
e->e.value.v.pointer.type = t;
|
||||
e->e.value.v.pointer.def = def;
|
||||
} else {
|
||||
e = new_unary_expr ('&', e1);
|
||||
e->e.expr.type = pointer_type (t);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return error (e1, "invalid type for unary &");
|
||||
|
|
Loading…
Reference in a new issue