authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-24 14:41:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-24 14:41:27-07:00
log15e891823e34ad57ccc5f1636323c5b7e718d44f
tree2ead1b5aca5e8c5745f0e631e635493cd7e02aff
parent15922069651ce964b6d12b9ad83ae02aa2266e89

AstGen: parser ensures all suspend have blocks

See #8603.

1 files changed, 1 insertions(+), 7 deletions(-)

src/AstGen.zig+1-7
...@@ -928,13 +928,7 @@ pub fn suspendExpr(...@@ -928,13 +928,7 @@ pub fn suspendExpr(
928 try astgen.errNoteNode(gz.suspend_node, "other suspend block here", .{}),928 try astgen.errNoteNode(gz.suspend_node, "other suspend block here", .{}),
929 });929 });
930 }930 }
931 if (body_node == 0) {931 assert(body_node != 0);
932 // Accepted proposal to remove block-less suspend from the language:
933 // https://github.com/ziglang/zig/issues/8603
934 // TODO: simplify the parser and make this an assert instead of
935 // a compile error.
936 return astgen.failNode(node, "suspend without a block", .{});
937 }
938932
939 const suspend_inst = try gz.addBlock(.suspend_block, node);933 const suspend_inst = try gz.addBlock(.suspend_block, node);
940 try gz.instructions.append(gpa, suspend_inst);934 try gz.instructions.append(gpa, suspend_inst);