mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Merge 60748f6f65 into d3e20e71be
This commit is contained in:
commit
414d62590c
3 changed files with 4 additions and 19 deletions
|
|
@ -493,9 +493,6 @@ pub fn renderError(tree: Ast, parse_error: Error, w: *Writer) Writer.Error!void
|
|||
.varargs_nonfinal => {
|
||||
return w.writeAll("function prototype has parameter after varargs");
|
||||
},
|
||||
.expected_continue_expr => {
|
||||
return w.writeAll("expected ':' before while continue expression");
|
||||
},
|
||||
|
||||
.expected_semi_after_decl => {
|
||||
return w.writeAll("expected ';' after declaration");
|
||||
|
|
@ -2974,7 +2971,6 @@ pub const Error = struct {
|
|||
test_doc_comment,
|
||||
comptime_doc_comment,
|
||||
varargs_nonfinal,
|
||||
expected_continue_expr,
|
||||
expected_semi_after_decl,
|
||||
expected_semi_after_stmt,
|
||||
expected_comma_after_field,
|
||||
|
|
|
|||
|
|
@ -2977,12 +2977,7 @@ fn expectFieldInit(p: *Parse) !Node.Index {
|
|||
|
||||
/// WhileContinueExpr <- COLON LPAREN AssignExpr RPAREN
|
||||
fn parseWhileContinueExpr(p: *Parse) !?Node.Index {
|
||||
_ = p.eatToken(.colon) orelse {
|
||||
if (p.tokenTag(p.tok_i) == .l_paren and
|
||||
p.tokensOnSameLine(p.tok_i - 1, p.tok_i))
|
||||
return p.fail(.expected_continue_expr);
|
||||
return null;
|
||||
};
|
||||
_ = p.eatToken(.colon) orelse return null;
|
||||
_ = try p.expectToken(.l_paren);
|
||||
const node = try p.parseAssignExpr() orelse return p.fail(.expected_expr_or_assignment);
|
||||
_ = try p.expectToken(.r_paren);
|
||||
|
|
|
|||
|
|
@ -5425,17 +5425,11 @@ test "zig fmt: while continue expr" {
|
|||
\\ while (i > 0)
|
||||
\\ (i * 2);
|
||||
\\}
|
||||
\\T: (while (true) ({
|
||||
\\ break usize;
|
||||
\\})),
|
||||
\\
|
||||
);
|
||||
try testError(
|
||||
\\test {
|
||||
\\ while (i > 0) (i -= 1) {
|
||||
\\ print("test123", .{});
|
||||
\\ }
|
||||
\\}
|
||||
, &[_]Error{
|
||||
.expected_continue_expr,
|
||||
});
|
||||
}
|
||||
|
||||
test "zig fmt: canonicalize symbols (simple)" {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue