authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-05-30 23:07:04+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-05-30 23:07:51+03:00
log010c58e3038ad9ca898b4c6e76877e4e7c43968f
treee2725b755bbcd63861b38fc22bab627483d774b8
parent51682717d773aa4bdee89bc67cab08dc9b4bcc15
signaturelock-open Commit is signed but in an unrecognized format.

fix zig fmt out of bounds on empty file


2 files changed, 8 insertions(+), 0 deletions(-)

lib/std/zig/parser_test.zig+6
......@@ -223,6 +223,12 @@ test "recovery: missing block after for/while loops" {
223223 });
224224}
225225
226test "zig fmt: empty file" {
227 try testCanonical(
228 \\
229 );
230}
231
226232test "zig fmt: if statment" {
227233 try testCanonical(
228234 \\test "" {
lib/std/zig/render.zig+2
......@@ -82,6 +82,8 @@ fn renderRoot(
8282 var start_col: usize = 0;
8383 var decl_i: ast.NodeIndex = 0;
8484 const root_decls = tree.root_node.decls();
85
86 if (root_decls.len == 0) return;
8587 while (true) {
8688 var decl = root_decls[decl_i];
8789