mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Print types properly in pointer value expressions
This commit is contained in:
parent
b996fb7aa4
commit
f7825fe7cf
1 changed files with 13 additions and 4 deletions
|
@ -428,6 +428,11 @@ print_value (dstring_t *dstr, expr_t *e, int level, int id, expr_t *next)
|
||||||
int indent = level * 2 + 2;
|
int indent = level * 2 + 2;
|
||||||
type_t *type;
|
type_t *type;
|
||||||
const char *label = "?!?";
|
const char *label = "?!?";
|
||||||
|
static dstring_t *type_str;
|
||||||
|
|
||||||
|
if (!type_str) {
|
||||||
|
type_str = dstring_newstr ();
|
||||||
|
}
|
||||||
|
|
||||||
switch (e->e.value->lltype) {
|
switch (e->e.value->lltype) {
|
||||||
case ev_string:
|
case ev_string:
|
||||||
|
@ -451,14 +456,18 @@ print_value (dstring_t *dstr, expr_t *e, int level, int id, expr_t *next)
|
||||||
break;
|
break;
|
||||||
case ev_pointer:
|
case ev_pointer:
|
||||||
type = e->e.value->v.pointer.type;
|
type = e->e.value->v.pointer.type;
|
||||||
|
dstring_clearstr(type_str);
|
||||||
|
if (type) {
|
||||||
|
print_type_str (type_str, type);
|
||||||
|
}
|
||||||
if (e->e.value->v.pointer.def)
|
if (e->e.value->v.pointer.def)
|
||||||
label = va ("(%s)[%d]<%s>",
|
label = va ("(*%s)[%d]<%s>",
|
||||||
type ? pr_type_name[type->type] : "???",
|
type ? type_str->str : "???",
|
||||||
e->e.value->v.pointer.val,
|
e->e.value->v.pointer.val,
|
||||||
e->e.value->v.pointer.def->name);
|
e->e.value->v.pointer.def->name);
|
||||||
else
|
else
|
||||||
label = va ("(%s)[%d]",
|
label = va ("(*%s)[%d]",
|
||||||
type ? pr_type_name[type->type] : "???",
|
type ? type_str->str : "???",
|
||||||
e->e.value->v.pointer.val);
|
e->e.value->v.pointer.val);
|
||||||
break;
|
break;
|
||||||
case ev_field:
|
case ev_field:
|
||||||
|
|
Loading…
Reference in a new issue