diff options
| author | Mustafa Quraish <[email protected]> | 2022-02-02 02:14:10 -0500 |
|---|---|---|
| committer | Mustafa Quraish <[email protected]> | 2022-02-02 02:14:10 -0500 |
| commit | a5185aebb89eaa8ea318d7e3bf881f03349b789a (patch) | |
| tree | bc97f376a3820889ab99d5c70e934f12dd54eb0a /src/generator.c | |
| parent | Defer: Pop elements off the defer-stack when returning (diff) | |
| download | cup-a5185aebb89eaa8ea318d7e3bf881f03349b789a.tar.xz cup-a5185aebb89eaa8ea318d7e3bf881f03349b789a.zip | |
Modify how types are stored.
We now dynamically allocate the type structure, and recursively
store a reference to the original type if it's a pointer. For now it's
a little bit of a waste but it helps us future-proof stuff for more
complex things to come
Diffstat (limited to 'src/generator.c')
| -rw-r--r-- | src/generator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/generator.c b/src/generator.c index 7de9d32..d3e63de 100644 --- a/src/generator.c +++ b/src/generator.c @@ -49,7 +49,7 @@ void generate_expr_into_rax(Node *expr, FILE *out) // TODO: Different sized output for different types? if (expr->type == AST_LITERAL) { // TODO: More literal types - assert(expr->literal.type.type == TYPE_INT); + assert(expr->literal.type->type == TYPE_INT); fprintf(out, " mov rax, %d\n", expr->literal.as_int); } else if (expr->type == AST_FUNCCALL) { @@ -340,7 +340,7 @@ void generate_block(Node *block, FILE *out) assert(block->type == AST_BLOCK); for (int i = 0; i < block->block.num_children; i++) generate_statement(block->block.children[i], out); - + assert(defer_stack_count - cur_defer_pos >= 0); while (defer_stack_count > cur_defer_pos) { Node *deferred = defer_stack[--defer_stack_count]; |