| author | |
| committer | |
| log | 9ada7638a5dbb535ba37223a14478691dd60cf6a |
| tree | fd575717d5ca9e585b7d94e2028f80614dbf6c2d |
| parent | c79ee1fc8d3d44b3c11ca72b0fdb11a158beae63 |
2 files changed, 15 insertions(+), 0 deletions(-)
lib/std/zig/parse.zig+4| ... | @@ -2656,6 +2656,10 @@ const Parser = struct { | ... | @@ -2656,6 +2656,10 @@ const Parser = struct { |
| 2656 | p.tok_i += 2; | 2656 | p.tok_i += 2; |
| 2657 | return p.parseWhileTypeExpr(); | 2657 | return p.parseWhileTypeExpr(); |
| 2658 | }, | 2658 | }, |
| 2659 | .l_brace => { | ||
| 2660 | p.tok_i += 2; | ||
| 2661 | return p.parseBlock(); | ||
| 2662 | }, | ||
| 2659 | else => return p.addNode(.{ | 2663 | else => return p.addNode(.{ |
| 2660 | .tag = .identifier, | 2664 | .tag = .identifier, |
| 2661 | .main_token = p.nextToken(), | 2665 | .main_token = p.nextToken(), |
lib/std/zig/parser_test.zig+11| ... | @@ -4179,6 +4179,17 @@ test "zig fmt: proper indent line comment after multi-line single expr while loo | ... | @@ -4179,6 +4179,17 @@ test "zig fmt: proper indent line comment after multi-line single expr while loo |
| 4179 | ); | 4179 | ); |
| 4180 | } | 4180 | } |
| 4181 | 4181 | ||
| 4182 | test "zig fmt: function with labeled block as return type" { | ||
| 4183 | try testCanonical( | ||
| 4184 | \\fn foo() t: { | ||
| 4185 | \\ break :t bar; | ||
| 4186 | \\} { | ||
| 4187 | \\ baz(); | ||
| 4188 | \\} | ||
| 4189 | \\ | ||
| 4190 | ); | ||
| 4191 | } | ||
| 4192 | |||
| 4182 | test "zig fmt: line comment after multiline single expr if statement with multiline string" { | 4193 | test "zig fmt: line comment after multiline single expr if statement with multiline string" { |
| 4183 | try testCanonical( | 4194 | try testCanonical( |
| 4184 | \\test { | 4195 | \\test { |