main+playground: Don't print nil values in repl

This makes the output of `print` in the repl nicer :)
This commit is contained in:
Laria 2022-10-30 22:43:38 +01:00
parent c18df0ab19
commit 4ecfeabded
2 changed files with 10 additions and 2 deletions

View file

@ -170,7 +170,11 @@ repl_eval(void)
while (apfl_iterative_runner_next(runner)) {
switch (apfl_iterative_runner_get_result(runner)) {
case APFL_RESULT_OK :
assert(apfl_debug_print_val(ctx, -1, apfl_format_file_writer(stdout)));
if (apfl_get_type(ctx, -1) == APFL_VALUE_NIL) {
apfl_drop(ctx, -1);
} else {
assert(apfl_debug_print_val(ctx, -1, apfl_format_file_writer(stdout)));
}
break;
case APFL_RESULT_ERR:
dump_stack_error(ctx, runner);

View file

@ -107,7 +107,11 @@ main(void)
while (apfl_iterative_runner_next(runner)) {
switch (apfl_iterative_runner_get_result(runner)) {
case APFL_RESULT_OK :
assert(apfl_debug_print_val(ctx, -1, w_ok));
if (apfl_get_type(ctx, -1) == APFL_VALUE_NIL) {
apfl_drop(ctx, -1);
} else {
assert(apfl_debug_print_val(ctx, -1, w_ok));
}
break;
case APFL_RESULT_ERR:
dump_stack_error(ctx, runner, w_err);