Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4eb148d17 | ||
|
|
dbca3129ab | ||
|
|
e3878047d7 |
+1
-1
@@ -59,7 +59,7 @@ foreach (TEST_FILE IN LISTS TEST_PROGS)
|
||||
set_tests_properties("progs_runtime_${TEST_NAME}" PROPERTIES WILL_FAIL TRUE)
|
||||
endif()
|
||||
|
||||
if (TEST_NAME MATCHES "neg1_")
|
||||
if (TEST_NAME MATCHES "negr_")
|
||||
set_tests_properties("progs_runtime_${TEST_NAME}" PROPERTIES WILL_FAIL TRUE)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
+12
-11
@@ -258,7 +258,7 @@ fzl_walk_res_t walk(fzl_walker_t *walker, fzl_node_t *node)
|
||||
|
||||
push_op(walker, FZL_OPCODE_MK_ENVTABLE);
|
||||
walker->syms[walker->sym_top++] = fzl_mksymt();
|
||||
size_t loop_begin_ip = walker->op_count;
|
||||
// size_t loop_begin_ip = walker->op_count;
|
||||
|
||||
if (node->loop.init)
|
||||
{
|
||||
@@ -316,16 +316,17 @@ fzl_walk_res_t walk(fzl_walker_t *walker, fzl_node_t *node)
|
||||
|
||||
push_op(walker, FZL_OPCODE_RM_ENVTABLE);
|
||||
|
||||
bool is_infinite =
|
||||
is_infinite_loop(walker, node, loop_begin_ip, walker->op_count - 2);
|
||||
if (is_infinite)
|
||||
{
|
||||
free(newctx->breaks);
|
||||
snprintf(wlast_err, sizeof(wlast_err),
|
||||
"'%s': infinite loop detected at %ld:%ld",
|
||||
node->token->filename, node->token->ln, node->token->cn);
|
||||
return (fzl_walk_res_t){.error = true, .error_msg = wlast_err};
|
||||
}
|
||||
// bool is_infinite =
|
||||
// is_infinite_loop(walker, node, loop_begin_ip, walker->op_count -
|
||||
// 2);
|
||||
// if (is_infinite)
|
||||
// {
|
||||
// free(newctx->breaks);
|
||||
// snprintf(wlast_err, sizeof(wlast_err),
|
||||
// "'%s': infinite loop detected at %ld:%ld",
|
||||
// node->token->filename, node->token->ln, node->token->cn);
|
||||
// return (fzl_walk_res_t){.error = true, .error_msg = wlast_err};
|
||||
// }
|
||||
|
||||
for (size_t i = walker->sym_top - 1; i > newctx->initial_env_lvl; i--)
|
||||
fzl_freesymt(walker->syms[--walker->sym_top]);
|
||||
|
||||
+5
-1
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user