[qfcc] Fix a missed address expression conversion

Found while testing operator renaming.
This commit is contained in:
Bill Currie 2022-01-20 00:42:29 +09:00
parent 105d57f5e7
commit 30008aeb13
3 changed files with 4 additions and 3 deletions

View file

@ -94,6 +94,7 @@ extern struct type_s type_object;
extern struct type_s type_class;
extern struct type_s type_Class;
extern struct type_s type_protocol;
extern struct type_s type_selector;
extern struct type_s type_SEL;
extern struct type_s type_IMP;
extern struct type_s type_supermsg;

View file

@ -112,8 +112,8 @@ selector_expr (keywordarg_t *selector)
reloc_def_def (sel_table->s.def, sel_sym->s.def);
}
sel_ref = new_symbol_expr (sel_sym);
sel_ref = new_binary_expr ('&', sel_ref, new_short_expr (index));
sel_ref->e.expr.type = &type_SEL;
sel_ref = new_address_expr (&type_selector, sel_ref,
new_short_expr (index));
expr_t *sel = new_expr ();
sel->type = ex_selector;

View file

@ -492,7 +492,7 @@ get_selector (expr_t *sel)
error (sel, "not a selector");
return 0;
}
_sel.index = expr_short (sel->e.expr.e2);
_sel.index = expr_short (sel->e.address.offset);
_sel.index /= type_size (type_SEL.t.fldptr.type);
return (selector_t *) Hash_FindElement (sel_index_hash, &_sel);
}