diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-12-14 11:40:33 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-12-14 11:40:33 -0500 |
commit | 71408de2e2b2aace1982c5a24b1ffc61229866c1 (patch) | |
tree | 0f7adf03060c463773b7a5fe43b1fe3b207fc8a4 | |
parent | e69a6cb8ff340baae6e4adee5414238751beaa1f (diff) |
small bug fix (arr_clear => arr_cleara)
-rw-r--r-- | parse.c | 2 | ||||
-rw-r--r-- | types.c | 7 |
2 files changed, 5 insertions, 4 deletions
@@ -2021,8 +2021,6 @@ static void fprint_arg_exprs(FILE *out, Expression *args) { fprintf(out, "("); arr_foreach(args, Expression, arg) { if (arg != args) fprintf(out, ", "); - Expression *last = arr_last(args); - assert(arg<=last); fprint_expr(out, arg); } fprintf(out, ")"); @@ -1367,7 +1367,10 @@ static bool types_expr(Typer *tr, Expression *e) { c->instance = instance_table_adda(tr->allocr, &original_fn->instances, table_index, &table_index_type, &instance_already_exists); - if (!instance_already_exists) { + if (instance_already_exists) { + arr_cleara(&table_index_type.tuple, tr->allocr); + arr_cleara(&table_index.tuple, tr->allocr); + } else { copy_block(&cop, &fn_copy.body, &original_fn->body); c->instance->fn = fn_copy; /* fix parameter and return types (they were kind of problematic before, because we didn't know about the instance) */ @@ -1380,7 +1383,7 @@ static bool types_expr(Typer *tr, Expression *e) { bool success = types_fn(tr, &c->instance->fn, &f->type, e->where, c->instance); arr_remove_last(&err_ctx->instance_stack); if (!success) return false; - arr_clear(&table_index_type.tuple); + arr_cleara(&table_index_type.tuple, tr->allocr); } } |