37 fprintf(stderr,
"DEBUG INDEX_SET: container.type=%d idx.type=%d value.type=%d\n",
42 fprintf(stderr,
"INDEX_SET index must be int for array\n");
46 fprintf(stderr,
"Runtime error: index out of range\n");
53 fprintf(stderr,
"INDEX_SET key must be string for map\n");
57 fprintf(stderr,
"Runtime error: map set failed\n");
63 fprintf(stderr,
"Runtime type error: INDEX_SET expects array or map\n");
int map_set(Value *vm, const char *key, Value v)
Insert or replace a key in the map.
Tagged union representing a Fun value.
void free_value(Value v)
Free dynamic storage owned by a Value.
int array_set(Value *v, int index, Value newElem)
Replace an element of an array with a new Value.
static Value pop_value(VM *vm)
Pop a Value from the VM operand stack.