astgen: add missing emitDbgNode for if condition

Port the emitDbgNode(parent_gz, cond_expr) call from upstream
AstGen.zig:6335 into ifExpr. This emits a DBG_STMT instruction
before evaluating the if condition, matching the reference output.

Enable astgen_test.zig corpus test (still has extra_len and
string_bytes mismatches to fix).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 05:45:50 +00:00
parent a79a049884
commit 2717f8ca91
2 changed files with 3 additions and 1 deletions

View File

@@ -4038,6 +4038,9 @@ static uint32_t ifExpr(GenZir* gz, Scope* scope, ResultLoc rl, uint32_t node) {
} }
} }
// Emit DBG_STMT for condition (AstGen.zig:6335).
emitDbgNode(gz, cond_node);
// Create block_scope (AstGen.zig:6326-6328). // Create block_scope (AstGen.zig:6326-6328).
GenZir block_scope = makeSubBlock(gz, scope); GenZir block_scope = makeSubBlock(gz, scope);

View File

@@ -1000,7 +1000,6 @@ test "astgen: corpus tokenizer_test.zig" {
} }
test "astgen: corpus astgen_test.zig" { test "astgen: corpus astgen_test.zig" {
if (true) return error.SkipZigTest; // TODO: 1 missing dbg_stmt, extra_len mismatch
const gpa = std.testing.allocator; const gpa = std.testing.allocator;
try corpusCheck(gpa, "astgen_test.zig", @embedFile("astgen_test.zig")); try corpusCheck(gpa, "astgen_test.zig", @embedFile("astgen_test.zig"));
} }