diff options
| author | hachem <im@hachem.wtf> | 2026-09-19 12:03:34 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-09-19 12:03:34 +0200 |
| commit | 74a8a2b10a0513f5346ec47aa9b463e30f2b972e (patch) | |
| tree | fd126ece2e3e544c00866ba0aef03989c92a7a05 /eval.c | |
| parent | b20c46c555986a99be70de61d91bc225e53f31d2 (diff) | |
feat: add void, int32_t, byte, size_t, remove_cv_t
Diffstat (limited to 'eval.c')
| -rw-r--r-- | eval.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -63,6 +63,11 @@ static int evaluate_type(const struct Node* node, struct Type* out) out->number = 0; switch (node->kind) { + case TYPE_VOID: return 0; + case TYPE_INT32: out->kind = KIND_INT32; return 0; + case TYPE_BYTE: out->kind = KIND_BYTE; return 0; + case TYPE_SIZE: out->kind = KIND_SIZE; return 0; + case TYPE_REMOVE_CV: return evaluate_type(node->first, out); case TYPE_DECLTYPE: if (evaluate_value(node->first, &out->number)) return 1; @@ -81,8 +86,15 @@ static enum RunStatus emit(const struct Node* node) if (evaluate_type(node->first, &type)) return RUN_FAILED; - if (type.kind == KIND_VALUE) - (void)printf("%" PRId64 "\n", type.number); + switch (type.kind) + { + case KIND_VOID: break; + case KIND_INT32: (void)printf("int32_t\n"); break; + case KIND_BYTE: (void)printf("byte\n"); break; + case KIND_SIZE: (void)printf("size_t\n"); break; + case KIND_VALUE: (void)printf("%" PRId64 "\n", type.number); break; + } + return RUN_DONE; } |
