mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 17:12:15 +00:00
Support direct struct/union field access.
This commit is contained in:
parent
3c849b970b
commit
93a5808659
1 changed files with 12 additions and 0 deletions
|
@ -873,6 +873,18 @@ field_expr (expr_t *e1, expr_t *e2)
|
||||||
} else if (t1->type == ev_vector) {
|
} else if (t1->type == ev_vector) {
|
||||||
} else if (t1->type == ev_quat) {
|
} else if (t1->type == ev_quat) {
|
||||||
} else if (is_struct (t1)) {
|
} else if (is_struct (t1)) {
|
||||||
|
symtab_t *strct = t1->t.symtab;
|
||||||
|
symbol_t *sym = e2->e.symbol;//FIXME need to check
|
||||||
|
symbol_t *field;
|
||||||
|
|
||||||
|
field = symtab_lookup (strct, sym->name);
|
||||||
|
if (!field)
|
||||||
|
return new_error_expr ();
|
||||||
|
e2->type = ex_value;
|
||||||
|
e2->e.value.type = ev_short;
|
||||||
|
e2->e.value.v.short_val = field->s.offset;
|
||||||
|
e = address_expr (e1, e2, field->type);
|
||||||
|
return unary_expr ('.', e);
|
||||||
} else if (is_class (t1)) {
|
} else if (is_class (t1)) {
|
||||||
}
|
}
|
||||||
return type_mismatch (e1, e2, '.');
|
return type_mismatch (e1, e2, '.');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue