start creating base objects for runtime

This commit is contained in:
2025-06-24 01:55:01 +01:00
parent 74c71c3a1b
commit 498cd39c04
16 changed files with 414 additions and 153 deletions

View File

@@ -1,9 +1,17 @@
#include "object.h"
#include "../../memory.h"
#include "../runtime.h"
#include <string.h>
ArgonObject* init_argon_object() {
ArgonObject *object = ar_alloc(sizeof(ArgonObject));
object->type = TYPE_OBJECT;
object->cls = object;
object->fields = createHashmap(8);
object->typeObject = NULL;
object->fields = createHashmap();
memset(&object->value, 0, sizeof(object->value));
return object;
}
void add_field(ArgonObject*target, char* name, ArgonObject *object) {
hashmap_insert(target->fields, siphash64_bytes(name, strlen(name)),name, object, 0);
}