diff options
author | Camil Staps | 2016-09-24 10:22:53 +0200 |
---|---|---|
committer | Camil Staps | 2016-09-24 10:22:53 +0200 |
commit | 314bcfc67fb95df06c8177cab8792b46b25d90fc (patch) | |
tree | a8b8a37b53938758378690ae2842f793eddaa262 /interpreter/code.c | |
parent | Fix one memory leak mentioned in #2; add debug dot graphs output (diff) |
Working graphs (?)
Diffstat (limited to 'interpreter/code.c')
-rw-r--r-- | interpreter/code.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/interpreter/code.c b/interpreter/code.c index d0b5416..e3cafa7 100644 --- a/interpreter/code.c +++ b/interpreter/code.c @@ -7,14 +7,14 @@ void fill_node_int(struct node** node, int i) { free_node(*node, 1, 0); - (*node)->kind = EXPR_INT; + (*node)->kind = NODE_INT; (*node)->var1 = my_calloc(1, sizeof(int)); *((int*) (*node)->var1) = i; } void fill_node_name(struct node** node, char* s) { free_node(*node, 1, 0); - (*node)->kind = EXPR_NAME; + (*node)->kind = NODE_NAME; (*node)->var1 = my_calloc(1, strlen(s) + 1); strcpy((*node)->var1, s); } @@ -24,14 +24,14 @@ void code_time(struct node** result) { } void code_mul(struct node** result, struct node* a, struct node* b) { - if (a->kind != EXPR_INT || b->kind != EXPR_INT) + if (a->kind != NODE_INT || b->kind != NODE_INT) fill_node_name(result, "mul on non-ints"); else fill_node_int(result, *((int*) a->var1) * *((int*) b->var1)); } void code_sub(struct node** result, struct node* a, struct node* b) { - if (a->kind != EXPR_INT || b->kind != EXPR_INT) + if (a->kind != NODE_INT || b->kind != NODE_INT) fill_node_name(result, "sub on non-ints"); else fill_node_int(result, *((int*) b->var1) - *((int*) a->var1)); |