diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-11-25 15:30:02 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-11-25 15:30:02 -0500 |
commit | 7e8028e1941ec1a6376b5ebd43964d334af4df72 (patch) | |
tree | 24093cf63561ae9d820b2f66d4ea376c52bd7203 | |
parent | 0c1d471fa16aca1840ef792e9f123ecf78d3df25 (diff) |
cleaning up
-rw-r--r-- | allocator.c | 2 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rwxr-xr-x | runv | 7 | ||||
-rw-r--r-- | test.toc | 13 | ||||
-rw-r--r-- | types.c | 2 |
5 files changed, 17 insertions, 11 deletions
diff --git a/allocator.c b/allocator.c index 202b238..aeae87f 100644 --- a/allocator.c +++ b/allocator.c @@ -1,7 +1,7 @@ static void *err_malloc(size_t bytes); static void *err_calloc(size_t n, size_t sz); static void *err_realloc(void *prev, size_t new_size); -#define NO_ALLOCATOR 1 /* useful for debugging; valgrind (maybe) checks writing past the end of a malloc, but that won't work with an allocator */ +/* #define NO_ALLOCATOR 1 /\* useful for debugging; valgrind (maybe) checks writing past the end of a malloc, but that won't work with an allocator *\/ */ /* number of bytes a page hold, not including the header */ #define PAGE_BYTES (16384 - sizeof(Page)) #define PAGE_MAX_ALIGNS (PAGE_BYTES / sizeof(MaxAlign)) @@ -1,9 +1,5 @@ /* TODO: -check for leaks -clean up - - switch to enums for flags struct parameters @@ -1,5 +1,10 @@ #!/bin/sh -valgrind -q --track-origins=yes --error-exitcode=1 --malloc-fill=0xcd --free-fill=0xef --num-callers=100 ./toc test.toc || exit 1 +if [ "$2" = "" ]; then + tocf=test.toc +else + tocf="$2" +fi +valgrind -q --track-origins=yes --error-exitcode=1 --malloc-fill=0xcd --free-fill=0xef --num-callers=100 ./toc $tocf || exit 1 if [ "$1" = "c" ]; then gcc out.c && ./a.out elif [ "$1" = "pc" ]; then @@ -8,11 +8,16 @@ puti @= fn(x: int) { // }; -f @= fn(x: int, r := x) y := x { +f @= fn(t @ Type, x: t) t { + x + 1 +}; + +g @= fn(x, y @ Type) int { +(3 as x) + (5 as y) }; main @= fn() { -R @= f(2837); -puti(R); - puti(f(3218)); + puti(f(int, 3)); + puti(f(u8, 255) as int); + puti(g(int, int)); };
\ No newline at end of file @@ -666,7 +666,7 @@ static bool types_fn(Typer *tr, FnExpr *f, Type *t, Location where, bool entered_fn = false; assert(t->kind == TYPE_FN); if (instance) { - *(Location *)arr_add(&err_ctx->instance_stack) = where; + *(Location *)typer_arr_add(tr, &err_ctx->instance_stack) = where; f = &instance->fn; } else { if (t->fn.constness) |