diff --git a/samples/strcat.noja b/samples/strcat.noja index a875948..657411d 100644 --- a/samples/strcat.noja +++ b/samples/strcat.noja @@ -11,7 +11,7 @@ fun append_esclamation_mark(A, n) i = 0; while i < n: - { + { A = strcat(A, '!'); i = i + 1; } @@ -19,4 +19,4 @@ fun append_esclamation_mark(A, n) return A; } -print(append_esclamation_mark(D, 7), '\n'); \ No newline at end of file +print(append_esclamation_mark(D, 3), '\n'); \ No newline at end of file diff --git a/src/runtime/o_closure.c b/src/runtime/o_closure.c index 71c1394..737fa4f 100644 --- a/src/runtime/o_closure.c +++ b/src/runtime/o_closure.c @@ -1,3 +1,6 @@ +// NOTE: This data structure doesn't strictly depend on +// the runtime, so it could be moved to src/objects. + #include "../utils/defs.h" #include "../objects/objects.h" diff --git a/src/runtime/o_nfunc.c b/src/runtime/o_nfunc.c index cfad689..ba61964 100644 --- a/src/runtime/o_nfunc.c +++ b/src/runtime/o_nfunc.c @@ -73,7 +73,10 @@ static Object *call(Object *self, Object **argv, unsigned int argc, Heap *heap, argv2[i] = Object_NewNone(heap, error); if(argv2[i] == NULL) - return 0; + { + free(argv2); + return NULL; + } } } else UNREACHABLE;