| author | |
| committer | |
| log | eef21df94fed2b77d8ca6a459686169bb6aca57b |
| tree | 60852cb236de9bca2b7c8b0db4fc9186c071cbf4 |
| parent | 8721eb68fc566ec5b71b3c8f90726fd815a3d45a |
2 files changed, 12 insertions(+), 13 deletions(-)
std/zig/parser.zig+4-3| ... | ... | @@ -1382,9 +1382,10 @@ pub const Parser = struct { |
| 1382 | 1382 | else => { |
| 1383 | 1383 | self.putBackToken(token); |
| 1384 | 1384 | self.putBackToken(ctx.comptime_token); |
| 1385 | const statememt = try ctx.block.statements.addOne(); | |
| 1386 | stack.append(State { .Semicolon = statememt }) catch unreachable; | |
| 1387 | try stack.append(State { .Expression = OptionalCtx { .Required = statememt } }); | |
| 1385 | const statement = try ctx.block.statements.addOne(); | |
| 1386 | stack.append(State { .LookForSameLineComment = statement }) catch unreachable; | |
| 1387 | try stack.append(State { .Semicolon = statement }); | |
| 1388 | try stack.append(State { .Expression = OptionalCtx { .Required = statement } }); | |
| 1388 | 1389 | continue; |
| 1389 | 1390 | } |
| 1390 | 1391 | } |
std/zig/parser_test.zig+8-10| ... | ... | @@ -6,16 +6,14 @@ |
| 6 | 6 | // format(&size, error{}, countSize, fmt, args) catch |err| switch (err) {}; |
| 7 | 7 | |
| 8 | 8 | |
| 9 | //TODO | |
| 10 | //test "zig fmt: same-line comptime" { | |
| 11 | // try testCanonical( | |
| 12 | // \\test "" { | |
| 13 | // \\ comptime assert(@typeId(T) == builtin.TypeId.Int); // must pass an integer to absInt | |
| 14 | // \\} | |
| 15 | // \\ | |
| 16 | // ); | |
| 17 | //} | |
| 18 | ||
| 9 | test "zig fmt: same-line comment on comptime expression" { | |
| 10 | try testCanonical( | |
| 11 | \\test "" { | |
| 12 | \\ comptime assert(@typeId(T) == builtin.TypeId.Int); // must pass an integer to absInt | |
| 13 | \\} | |
| 14 | \\ | |
| 15 | ); | |
| 16 | } | |
| 19 | 17 | |
| 20 | 18 | test "zig fmt: float literal with exponent" { |
| 21 | 19 | try testCanonical( |