feat: add "while-not-null" test

This commit is contained in:
samsonium
2026-10-25 01:54:07 +03:00
parent e3878047d7
commit dbca3129ab
2 changed files with 33 additions and 1 deletions
+5 -1
View File
@@ -208,7 +208,7 @@ void print_object(fzl_vm_object_t *obj)
printf("<unknown>");
}
printf(">\n");
printf(">");
}
void print_err_data(fzl_vm_t *vm)
@@ -435,6 +435,7 @@ int fzl_vm_run(fzl_vm_t *vm)
fzl_vm_object_t *obj = malloc(sizeof(fzl_vm_object_t));
obj->values = malloc(values_count * sizeof(fzl_value_t));
obj->values_count = values_count;
memset(obj->values, 0, values_count * sizeof(fzl_value_t));
fzl_vm_env_t *current_env = vm->estack[vm->etop - 1];
if (current_env->owned_objects_remainder <=
@@ -858,7 +859,10 @@ int fzl_vm_run(fzl_vm_t *vm)
else if (arg.type == FZL_TYPE_NULL)
printf("<null>\n");
else if (arg.type == FZL_TYPE_OBJECT)
{
print_object(arg.as.obj);
printf("\n");
}
}
else if (fn_id == FZL_BUILTIN_EXIT)
{
+28
View File
@@ -0,0 +1,28 @@
class Some {
Some next;
}
Some l4 = new Some;
Some l3 = new Some;
l3.next = l4;
Some l2 = new Some;
l2.next = l3;
Some l1 = new Some;
l1.next = l2;
Some root = new Some;
root.next = l1;
Some obj = root;
while (obj != null)
{
obj = obj.next;
printline("Now object is:");
printline(obj);
}
printline(obj);