diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-03-09 17:12:40 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-03-09 17:12:40 +0200 |
| commit | 01b454f8515312531ff0c70985203f9aecb022db (patch) | |
| tree | e5ac6ea062d051f5b062d3d11643d17e6dfd58ff /src | |
| parent | bb1fa0bdbd7235308362528e5c1ca408681064e9 (diff) | |
| download | zig-01b454f8515312531ff0c70985203f9aecb022db.tar.gz zig-01b454f8515312531ff0c70985203f9aecb022db.zip | |
AstGen: ensure lableld block implicitly ends in a break
Diffstat (limited to 'src')
| -rw-r--r-- | src/AstGen.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig index bd8f06ae59..e39c7abffe 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1991,6 +1991,9 @@ fn labeledBlockExpr( defer block_scope.labeled_breaks.deinit(astgen.gpa); try blockExprStmts(&block_scope, &block_scope.base, statements); + if (!block_scope.endsWithNoReturn()) { + _ = try block_scope.addBreak(.break_inline, block_inst, .void_value); + } if (!block_scope.label.?.used) { try astgen.appendErrorTok(label_token, "unused block label", .{}); |
