enum too is a scalar.

This commit is contained in:
Bill Currie 2011-02-06 20:01:55 +09:00
parent f2c272f0b8
commit 2860a8b28b
2 changed files with 12 additions and 3 deletions

View file

@ -142,6 +142,7 @@ void print_type (type_t *type);
const char *encode_params (type_t *type);
void encode_type (struct dstring_s *encoding, type_t *type);
type_t *parse_type (const char *str);
int is_enum (type_t *type);
int is_scalar (type_t *type);
int is_math (type_t *type);
int is_struct (type_t *type);

View file

@ -411,6 +411,8 @@ print_type_str (dstring_t *str, type_t *type)
dasprintf (str, " %s", type->t.class->name);
break;
case ty_enum:
dasprintf (str, " enum %s", type->name);
break;
case ty_struct:
case ty_union:
{
@ -419,8 +421,6 @@ print_type_str (dstring_t *str, type_t *type)
if (type->t.symtab) {//FIXME
if (type->t.symtab->type == stab_union)
tag = "union";
else if (type->t.symtab->type == stab_union)
tag = "enum";
}
dasprintf (str, " %s %s", tag, type->name);
}
@ -751,6 +751,14 @@ parse_type (const char *str)
return type;
}
int
is_enum (type_t *type)
{
if (type->type == ev_invalid && type->ty == ty_enum)
return 1;
return 0;
}
int
is_scalar (type_t *type)
{
@ -758,7 +766,7 @@ is_scalar (type_t *type)
if (t == ev_float || t == ev_integer || t == ev_short)
return 1;
return 0;
return is_enum (type);
}
int