Skip to content

Commit

Permalink
fix(while): Fixed while unknown node and working properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
natangscalvence committed Jan 17, 2025
1 parent 2951038 commit d53016c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/frontend/parser/printer/nodes/statements/print_while.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ void print_while(const AstNode *node, int depth, VisitedNodes *visited) {
WhileNode *while_data = (WhileNode *)node->data;

print_indent(depth + 1);
printf("Condition: \n");
print_ast_node(while_data->condition, depth + 2, visited);
if (while_data->condition) {
print_ast_node(while_data->condition, depth + 2, visited);
} else {
print_indent(depth + 2);
printf("Condition: <NULL>\n");
}

if (while_data->body_count > 0) {
print_indent(depth + 1);
Expand Down

0 comments on commit d53016c

Please sign in to comment.