object initialisation

This commit is contained in:
2026-07-08 12:06:18 +10:00
parent b507d79804
commit 6929f055de
4 changed files with 50 additions and 55 deletions

View File

@@ -1,4 +1,5 @@
#include "../../include/ground.h"
#include "../include/estr.h"
#include <inttypes.h>
char* _GroundStringifyBytecodeValue(GroundBytecodeValue* value) {
@@ -53,10 +54,24 @@ char* _GroundStringifyBytecodeValue(GroundBytecodeValue* value) {
// TODO implement function stringification
}
case GroundType_Struct: {
// TODO implement struct stringification
Estr str = CREATE_ESTR("<struct fields: { ");
for (GroundSize i = 0; i < value->as.Struct.size; i++) {
char* field = Ground.Stringify.BytecodeValue(&value->as.Struct.values[i]);
APPEND_ESTR(str, field);
free(field);
}
APPEND_ESTR(str, " }>");
return str.str;
}
case GroundType_Object: {
// TODO implement object stringification
Estr str = CREATE_ESTR("<object fields: { ");
for (GroundSize i = 0; i < value->as.Struct.size; i++) {
char* field = Ground.Stringify.BytecodeValue(&value->as.Struct.values[i]);
APPEND_ESTR(str, field);
free(field);
}
APPEND_ESTR(str, " }>");
return str.str;
}
}