Skip to content

Commit

Permalink
Selfhost: More consistent else if chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
N00byEdge committed Oct 4, 2023
1 parent 622fdef commit c0b1eb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions selfhost/parser.n
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,15 @@ fn parse_statement(context: *ParserContext) u32 {
const result = add_with_token(token, .local_var_decl);
node_payload.get(result).* = type_expr;
return result;
} else if(p == .__keyword) {
}
else if(p == .__keyword) {
const token = context.advance();
context.expect("Expected '=' after '_'".&, .@"=");
parse_expression(context);
context.expect("Expected ';' after expression to discard".&, .@";");
return add_with_token(token, .discard);
} else {
}
else {
const result = parse_expression(context);
context.expect("Expected ';' after expression statement".&, .@";");
return result;
Expand Down

0 comments on commit c0b1eb9

Please sign in to comment.