diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-02-25 22:42:22 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-02-25 22:42:22 +0200 |
| commit | ee50ee4ef760521c0764177b3bb8fed25beb2092 (patch) | |
| tree | 667aa45aa853e31e856f557fe73325929cb8fa08 /src/analyze.c | |
| parent | 99601456e6ad4c86287ba786923c99c5499037e0 (diff) | |
| download | fwd-ee50ee4ef760521c0764177b3bb8fed25beb2092.tar.gz fwd-ee50ee4ef760521c0764177b3bb8fed25beb2092.zip | |
vec example produces C, but broken C
Diffstat (limited to 'src/analyze.c')
| -rw-r--r-- | src/analyze.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/analyze.c b/src/analyze.c index 04b7856..c05542a 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -447,16 +447,9 @@ static int analyze_str(struct state *state, struct scope *scope, (void)scope; /** @todo do this properly, very hacky, bad bad bad */ - char *i = strdup("char"); - if (!i) { - internal_error("failed allocating constant char type string"); - return -1; - } - - struct type *ch = tgen_id(i, node->loc); + struct type *ch = tgen_type(TYPE_U8, NULL, NULL, node->loc); if (!ch) { internal_error("failed allocating constant char type"); - free(i); return -1; } @@ -1117,13 +1110,15 @@ static struct type *fwd_type_kind(fwd_type_t type) { switch (type) { case FWD_VOID: return tgen_void(NULL_LOC()); + case FWD_I8: return tgen_type(TYPE_I8, NULL, NULL, NULL_LOC()); + case FWD_I16: return tgen_type(TYPE_I16, NULL, NULL, NULL_LOC()); + case FWD_I32: return tgen_type(TYPE_I32, NULL, NULL, NULL_LOC()); case FWD_I64: return tgen_type(TYPE_I64, NULL, NULL, NULL_LOC()); + case FWD_U8: return tgen_type(TYPE_U8, NULL, NULL, NULL_LOC()); + case FWD_U16: return tgen_type(TYPE_U16, NULL, NULL, NULL_LOC()); + case FWD_U32: return tgen_type(TYPE_U32, NULL, NULL, NULL_LOC()); case FWD_U64: return tgen_type(TYPE_U64, NULL, NULL, NULL_LOC()); - case FWD_PTR: { - /* hack? */ - return tgen_nil(NULL_LOC()); - } - + case FWD_PTR: return tgen_nil(NULL_LOC()); default: break; } |
