WIP: Scopes weren't tracking their content sizes

'print' no longer segfaults from a long chain of indirect memory frees.

It still doesn't work though, which is odd.
This commit is contained in:
2026-04-06 21:50:41 +10:00
parent abae97b6e5
commit 1ae3fcbf73
10 changed files with 12 additions and 219 deletions

View File

@@ -11,18 +11,18 @@ typedef struct Toy_ScopeEntry {
Toy_String key;
Toy_Value value;
Toy_ValueType type;
unsigned int psl; //psl '0' means empty
bool constant;
unsigned int psl;
} Toy_ScopeEntry;
//holds a table-like collection of variables TODO: check bitness
typedef struct Toy_Scope {
struct Toy_Scope* next;
unsigned int refCount;
Toy_ScopeEntry* data;
unsigned int capacity;
unsigned int count;
unsigned int maxPsl;
Toy_ScopeEntry* data;
} Toy_Scope;
//handle deep scopes - the scope is stored in the bucket, not the table