diff options
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/type.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/compiler/parser/type.c b/compiler/parser/type.c index 5e161b4..4b961f0 100644 --- a/compiler/parser/type.c +++ b/compiler/parser/type.c @@ -14,19 +14,6 @@ #define HASHMAP_ROWS 8 -static struct type * -type_new(struct token *tok) -{ - struct type *typ; - - typ = malloc(sizeof(struct type)); - typ->hashmap_entry.hash = tok->hash; - typ->name = tok->pos; - typ->name_len = tok->len; - - return typ; -} - static void free_all(struct hashmap *map) { @@ -48,8 +35,6 @@ parse_type_ref(struct parser *ctx, struct type **typ_out, int *n_ptrs_out) struct type *typ; int n_ptrs; - debug("Parsing type reference...\n"); - /* Find type */ typ = (struct type*)hashmap_find(ctx->types, ctx->tok.hash); if (typ == NULL) { @@ -265,7 +250,10 @@ parse_type(struct parser *ctx) } /* Create type */ - typ = type_new(&ctx->tok); + typ = malloc(sizeof(struct type)); + typ->hashmap_entry.hash = ctx->tok.hash; + typ->name = ctx->tok.pos; + typ->name_len = ctx->tok.len; if (next_token(ctx)->kind != TK_COLON) { tok_error(&ctx->tok, "expected \":\" after type name\n"); |