astgen: catch error capture, @panic, @errorName, @field, larger block scopes

- Add error capture scope to orelseCatchExpr (catch |err| now creates
  a ScopeLocalVal for the captured error variable)
- Add @panic, @errorName, @field builtins
- Increase blockExprStmts scope arrays from 64 to 128 entries
  (build.zig has 93 var decls in a single block)

corpus build.zig still skipped: needs switchExprErrUnion optimization
(catch |err| switch(err) pattern).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 09:15:14 +00:00
parent 3aced7124e
commit b2592f40be
2 changed files with 92 additions and 17 deletions

View File

@@ -793,6 +793,9 @@ test "astgen: corpus test_all.zig" {
}
test "astgen: corpus build.zig" {
// TODO: 6 extra instructions — missing switchExprErrUnion optimization
// (catch |err| switch(err) pattern emits SWITCH_BLOCK instead of
// SWITCH_BLOCK_ERR_UNION).
if (true) return error.SkipZigTest;
const gpa = std.testing.allocator;
try corpusCheck(gpa, @embedFile("../build.zig"));