Update TODO statuses

This commit is contained in:
2022-11-15 00:15:48 -05:00
parent af88471b3a
commit 583367ee9d
9 changed files with 27 additions and 23 deletions

View File

@@ -40,13 +40,10 @@ struct ucl_object *ucl_evaluate_builtin_form(struct ucl_scope *scope, struct ucl
assert(0);
}
// TODO: cleanup
return (result == NULL) ? ucl_nil_create() : result;
}
struct ucl_object *ucl_evaluate_special_form(struct ucl_scope *scope, struct ucl_object *list) {
// TODO: Recursively eval args
const char *fun_sym = ucl_car(list)->symbol;
struct ucl_object *fun = ucl_scope_get(scope, fun_sym);
@@ -72,7 +69,6 @@ struct ucl_object *ucl_evaluate_list(struct ucl_scope *scope, struct ucl_object
return ucl_evaluate_builtin_form(scope, list);
} else {
assert(0);
// TODO: Lisp functions and other errors
}
}

View File

@@ -15,7 +15,6 @@
// TODO: Refactor this struct's location
struct ucl_scope {
// TODO: For garbage collection, we need references from the parent->child state
struct ucl_object *list;
struct ucl_scope *parent;
};

View File

@@ -67,7 +67,6 @@ int main(int argc, const char **argv) {
// TODO:
// - reduce
// - booleans (e.g. not)
if (argc < 2) {
while (1) {

View File

@@ -122,7 +122,7 @@ void ucl_object_delete(struct ucl_object *obj) {
ucl_arena_put(object_arena, obj);
}
void ucl_object_mark(struct ucl_object *obj) {
static void ucl_object_mark(struct ucl_object *obj) {
if (obj == NULL || obj->reachable) {
return;
}
@@ -134,34 +134,45 @@ void ucl_object_mark(struct ucl_object *obj) {
}
}
void ucl_scope_mark(struct ucl_arena * arena, void *obj) {
static void ucl_scope_mark(struct ucl_arena * arena, void *obj) {
(void) arena;
struct ucl_scope *scope = (struct ucl_scope *) obj;
ucl_object_mark(scope->list);
}
void ucl_gc_unmark(struct ucl_arena * arena, void *obj) {
static void ucl_gc_unmark(struct ucl_arena * arena, void *obj) {
(void) arena;
struct ucl_object *object = (struct ucl_object *) obj;
object->reachable = 0;
}
void ucl_gc_sweep(struct ucl_arena * arena, void *obj) {
static void ucl_gc_sweep(struct ucl_arena * arena, void *obj) {
(void) arena;
struct ucl_object *object = (struct ucl_object *) obj;
if (object->reachable == 0) {
// TODO: Mapping across this is broken, since this is a recursive delete
ucl_object_delete(object);
ucl_object_delete(object);
}
}
static void ucl_gc_deleteall(struct ucl_arena * arena, void *obj) {
(void) arena;
struct ucl_object *object = (struct ucl_object *) obj;
ucl_object_delete(object);
}
void ucl_gc() {
ucl_arena_map(object_arena, ucl_gc_unmark);
if (object_arena == NULL) {
return;
}
ucl_arena_map(scope_arena, ucl_scope_mark);
if (scope_arena != NULL) {
ucl_arena_map(object_arena, ucl_gc_unmark);
ucl_arena_map(scope_arena, ucl_scope_mark);
ucl_arena_map(object_arena, ucl_gc_sweep);
} else {
ucl_arena_map(object_arena, ucl_gc_deleteall);
}
ucl_arena_map(object_arena, ucl_gc_sweep);
}

View File

@@ -21,7 +21,6 @@ struct ucl_object *ucl_special_let(struct ucl_scope *scope, struct ucl_object *a
//assert(ucl_list_length(expr)->integer == 1);
if (value->type == UCL_TYPE_ERROR) {
// TODO cleanup
ucl_scope_delete(let_scope);
return value;
}