AstGen: do not generate defers at unreachable end of block

Resolves: #8822
This commit is contained in:
mlugg 2024-02-27 02:15:32 +00:00
parent f6abf022b7
commit 07d8740882
No known key found for this signature in database
GPG Key ID: 58978E823BDE3EF9

View File

@ -2563,7 +2563,9 @@ fn blockExprStmts(gz: *GenZir, parent_scope: *Scope, statements: []const Ast.Nod
}
}
try genDefers(gz, parent_scope, scope, .normal_only);
if (noreturn_src_node == 0) {
try genDefers(gz, parent_scope, scope, .normal_only);
}
try checkUsed(gz, parent_scope, scope);
}