File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -3839,12 +3839,13 @@ pub const Parser = struct {
3839
3839
},
3840
3840
ast .Node .Id .Else = > {
3841
3841
const else_node = @fieldParentPtr (ast .NodeElse , "base" , base );
3842
- try stream .print ("{} " , self .tokenizer .getTokenSlice (else_node .else_token ));
3842
+ try stream .print ("{}" , self .tokenizer .getTokenSlice (else_node .else_token ));
3843
3843
3844
3844
switch (else_node .body .id ) {
3845
3845
ast .Node .Id .Block , ast .Node .Id .If ,
3846
3846
ast .Node .Id .For , ast .Node .Id .While ,
3847
3847
ast .Node .Id .Switch = > {
3848
+ try stream .print (" " );
3848
3849
try stack .append (RenderState { .Expression = else_node .body });
3849
3850
},
3850
3851
else = > {
@@ -4805,6 +4806,11 @@ test "zig fmt: while" {
4805
4806
\\ unreachable;
4806
4807
\\ };
4807
4808
\\
4809
+ \\ const res = while (0 < 10)
4810
+ \\ break 7
4811
+ \\ else
4812
+ \\ unreachable;
4813
+ \\
4808
4814
\\ var a: error!u8 = 0;
4809
4815
\\ while (a) |v| {
4810
4816
\\ a = error.Err;
You can’t perform that action at this time.
0 commit comments