Proper pretty printing and error handling on non-cool if condition.

This commit is contained in:
2025-01-15 21:32:18 +01:00
parent a72a9ff50d
commit b4d119230b
16 changed files with 249 additions and 85 deletions

View File

@@ -794,6 +794,7 @@ statement :: (parse_state : *Parse_State) -> *AST_Node {
if_expression := expression(parse_state);
add_child(node, if_expression);
// consume(parse_state, .TOKEN_LEFTBRACE, "Expect '{' after if-condition.");
source_location.end = parse_state.previous;
if_body := block(parse_state);
if if_body.children.count > 0 {
@@ -804,8 +805,7 @@ statement :: (parse_state : *Parse_State) -> *AST_Node {
else_node := else_statement(parse_state);
add_child(node, else_node);
}
source_location.end = parse_state.previous;
node.source_location = source_location;
return node;