diff options
-rw-r--r-- | cgen.c | 2 | ||||
-rw-r--r-- | parse.c | 4 | ||||
-rw-r--r-- | test.toc | 12 |
3 files changed, 4 insertions, 14 deletions
@@ -486,7 +486,6 @@ static inline void cgen_arg_pre(CGenerator *g, Expression *arg) { if (arg->type.kind == TYPE_ARR) { /* create copy of array */ IdentID copy = ++g->ident_counter; - arg->cgen.id = copy; cgen_type_pre(g, &arg->type); char s[CGEN_IDENT_ID_STR_SIZE]; cgen_ident_id_to_str(s, copy); @@ -495,6 +494,7 @@ static inline void cgen_arg_pre(CGenerator *g, Expression *arg) { cgen_type_post(g, &arg->type); cgen_write(g, "; "); cgen_set(g, NULL, s, arg, NULL); + arg->cgen.id = copy; } } @@ -405,14 +405,14 @@ static Token *expr_find_end(Parser *p, ExprEndFlags flags) { } if (token->kind == TOKEN_EOF) { if (brace_level > 0) { - tokr_err(t, "Opening brace { was never closed."); /* FEATURE: Find out where this is */ + tokr_err(t, "Opening brace { was never closed."); /* TODO: Find out where this is */ } else if (paren_level > 0) { tokr_err(t, "Opening parenthesis ( was never closed."); } else if (square_level > 0) { tokr_err(t, "Opening square bracket [ was never closed."); } else { tokr_err(t, "Could not find end of expression (did you forget a semicolon?)."); - /* FEATURE: improve err message */ + /* TODO: ? improve err message */ } t->token = token; /* don't try to continue */ return NULL; @@ -1,5 +1,3 @@ -#include "io.toc", io; - arr_sum ::= fn(n::=, t::=, a:[n]t) t { total := 0 as t; for x := a { @@ -15,13 +13,5 @@ mk_arr ::= fn(x:int, y:int, z:int) a:[3]int { }; main ::= fn() { - x ::= 3; - #if x > 2 { - io.puts("Hello!"); - } else { - foo("yes"); - } - io.puti(arr_sum(mk_arr(5,89,22))); - io.puti(arr_sum(mk_arr(1,2,3))); - io.puti(arr_sum(mk_arr(z=0, 0, 0))); + arr_sum(mk_arr(1,2,3)); };
\ No newline at end of file |