diff options
Diffstat (limited to 'src/ast_pretty_printer.c')
-rw-r--r-- | src/ast_pretty_printer.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/ast_pretty_printer.c b/src/ast_pretty_printer.c index 95f5993..718d22a 100644 --- a/src/ast_pretty_printer.c +++ b/src/ast_pretty_printer.c @@ -99,13 +99,33 @@ ast_pretty_printer_print_ast(ast_pretty_printer_t *printer, ast_node_t *ast) ast_pretty_printer_printf(printer, "FunctionDecl name='" SVFMT "'\n", SVARG(&function.identifier.name)); ast_pretty_printer_add_indentation(printer); - for (size_t i = 0; i < function.body->size; ++i) { - if (i + 1 >= function.body->size) { - ast_pretty_printer_set_lst_children(printer); + { + ast_pretty_printer_set_lst_children(printer); + ast_pretty_printer_printf(printer, "body:\n"); + + ast_pretty_printer_add_indentation(printer); + { + ast_pretty_printer_print_ast(printer, ast->data.function.body); + ast_pretty_printer_rm_indentation(printer); + } + + ast_pretty_printer_rm_indentation(printer); + } + break; + } + case AST_BLOCK: { + ast_pretty_printer_set_lst_children(printer); + ast_pretty_printer_printf(printer, "Block\n"); + ast_pretty_printer_add_indentation(printer); + { + for (size_t i = 0; i < ast->data.block.body->size; ++i) { + if (i + 1 >= ast->data.block.body->size) { + ast_pretty_printer_set_lst_children(printer); + } + ast_pretty_printer_print_ast(printer, vector_at(ast->data.block.body, i)); } - ast_pretty_printer_print_ast(printer, vector_at(function.body, i)); + ast_pretty_printer_rm_indentation(printer); } - ast_pretty_printer_rm_indentation(printer); break; } case AST_LITERAL: { |