| author | |
| committer | |
| log | ee173d512721df521b5a29bc939770e098931e21 |
| tree | 4e0dbb24169a48ee5167671ce74fd1827619994f |
| parent | 4ea7470417b7b0c1069a0bc67d93511d3c06a2bf |
| signature |
3 files changed, 3 insertions(+), 31 deletions(-)
lib/std/zig/parse.zig+1-5| ... | @@ -885,11 +885,7 @@ const Parser = struct { | ... | @@ -885,11 +885,7 @@ const Parser = struct { |
| 885 | }, | 885 | }, |
| 886 | .keyword_suspend => { | 886 | .keyword_suspend => { |
| 887 | const token = p.nextToken(); | 887 | const token = p.nextToken(); |
| 888 | // TODO remove this special case when 0.9.0 is released. | 888 | const block_expr = try p.expectBlockExprStatement(); |
| 889 | const block_expr: Node.Index = if (p.eatToken(.semicolon) != null) | ||
| 890 | 0 | ||
| 891 | else | ||
| 892 | try p.expectBlockExprStatement(); | ||
| 893 | return p.addNode(.{ | 889 | return p.addNode(.{ |
| 894 | .tag = .@"suspend", | 890 | .tag = .@"suspend", |
| 895 | .main_token = token, | 891 | .main_token = token, |
lib/std/zig/parser_test.zig-15| ... | @@ -92,21 +92,6 @@ test "zig fmt: rewrite callconv(.Inline) to the inline keyword" { | ... | @@ -92,21 +92,6 @@ test "zig fmt: rewrite callconv(.Inline) to the inline keyword" { |
| 92 | ); | 92 | ); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | // TODO Remove this after zig 0.9.0 is released. | ||
| 96 | test "zig fmt: rewrite suspend without block expression" { | ||
| 97 | try testTransform( | ||
| 98 | \\fn foo() void { | ||
| 99 | \\ suspend; | ||
| 100 | \\} | ||
| 101 | \\ | ||
| 102 | , | ||
| 103 | \\fn foo() void { | ||
| 104 | \\ suspend {} | ||
| 105 | \\} | ||
| 106 | \\ | ||
| 107 | ); | ||
| 108 | } | ||
| 109 | |||
| 110 | // TODO Remove this after zig 0.9.0 is released. | 95 | // TODO Remove this after zig 0.9.0 is released. |
| 111 | test "zig fmt: rewrite @byteOffsetOf to @offsetOf" { | 96 | test "zig fmt: rewrite @byteOffsetOf to @offsetOf" { |
| 112 | try testTransform( | 97 | try testTransform( |
lib/std/zig/render.zig+2-11| ... | @@ -275,17 +275,8 @@ fn renderExpression(gpa: *Allocator, ais: *Ais, tree: ast.Tree, node: ast.Node.I | ... | @@ -275,17 +275,8 @@ fn renderExpression(gpa: *Allocator, ais: *Ais, tree: ast.Tree, node: ast.Node.I |
| 275 | .@"suspend" => { | 275 | .@"suspend" => { |
| 276 | const suspend_token = main_tokens[node]; | 276 | const suspend_token = main_tokens[node]; |
| 277 | const body = datas[node].lhs; | 277 | const body = datas[node].lhs; |
| 278 | if (body != 0) { | 278 | try renderToken(ais, tree, suspend_token, .space); |
| 279 | try renderToken(ais, tree, suspend_token, .space); | 279 | return renderExpression(gpa, ais, tree, body, space); |
| 280 | return renderExpression(gpa, ais, tree, body, space); | ||
| 281 | } else { | ||
| 282 | // TODO remove this special case when 0.9.0 is released. | ||
| 283 | assert(space == .semicolon); | ||
| 284 | try renderToken(ais, tree, suspend_token, .space); | ||
| 285 | try ais.writer().writeAll("{}"); | ||
| 286 | try ais.insertNewline(); | ||
| 287 | return; | ||
| 288 | } | ||
| 289 | }, | 280 | }, |
| 290 | 281 | ||
| 291 | .@"catch" => { | 282 | .@"catch" => { |