From 4ecfeabded9cbf632ae866a0e759cd431142f94c Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sun, 30 Oct 2022 22:43:38 +0100 Subject: [PATCH] main+playground: Don't print nil values in repl This makes the output of `print` in the repl nicer :) --- src/main.c | 6 +++++- webpage/playground/playground.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 865a0a8..e41fbb5 100644 --- a/src/main.c +++ b/src/main.c @@ -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); diff --git a/webpage/playground/playground.c b/webpage/playground/playground.c index 9f630eb..899b5c4 100644 --- a/webpage/playground/playground.c +++ b/webpage/playground/playground.c @@ -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);