diff options
Diffstat (limited to 'expression.c')
-rw-r--r-- | expression.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/expression.c b/expression.c index dc503ca..1583874 100644 --- a/expression.c +++ b/expression.c @@ -200,23 +200,23 @@ struct token *primary_expression(struct token *token, struct expression **tree) case TOKEN_IDENT: { struct symbol *sym = lookup_symbol(token->ident, NS_SYMBOL | NS_TYPEDEF); + struct token *next = token->next; + + expr = alloc_expression(token->pos, EXPR_SYMBOL); /* - * I'd like to support types as real first-class citizens, - * with type comparisons etc: + * We support types as real first-class citizens, with type + * comparisons etc: * * if (typeof(a) == int) .. - * - * But for now just do normal C. */ if (sym && sym->namespace == NS_TYPEDEF) { - warn(token->pos, "We don't support type expressions (yet?)"); - sym = NULL; + next = typename(token, &sym); + expr->type = EXPR_TYPE; } - expr = alloc_expression(token->pos, EXPR_SYMBOL); expr->symbol_name = token->ident; expr->symbol = sym; - token = token->next; + token = next; break; } |