astgen: fix while loop dbg_node, block expr rvalue, int_type data issue
- whileExpr: emit emitDbgNode before condition evaluation to match upstream AstGen.zig:6579. Fixes astgen_test.zig corpus (1 missing DBG_STMT). - Block expressions in exprRl: wrap blockExprExpr result with rvalue() to handle result location storage (RL_PTR → STORE_NODE, etc.). Fixes parser_test.zig inst_len to exact match. - parser_test.zig corpus now has matching inst_len and all tags, but has 1 int_type data signedness mismatch (pre-existing issue). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
4
astgen.c
4
astgen.c
@@ -4374,7 +4374,7 @@ static uint32_t exprRl(GenZir* gz, Scope* scope, ResultLoc rl, uint32_t node) {
|
||||
case AST_NODE_BLOCK_TWO_SEMICOLON:
|
||||
case AST_NODE_BLOCK:
|
||||
case AST_NODE_BLOCK_SEMICOLON:
|
||||
return blockExprExpr(gz, scope, rl, node);
|
||||
return rvalue(gz, rl, blockExprExpr(gz, scope, rl, node), node);
|
||||
// Anonymous array init (AstGen.zig:1119-1127).
|
||||
case AST_NODE_ARRAY_INIT_DOT_TWO:
|
||||
case AST_NODE_ARRAY_INIT_DOT_TWO_COMMA:
|
||||
@@ -5611,6 +5611,8 @@ static uint32_t whileExpr(
|
||||
|
||||
// Evaluate condition in cond_scope (AstGen.zig:6571-6607).
|
||||
GenZir cond_scope = makeSubBlock(&loop_scope, &loop_scope.base);
|
||||
// Emit debug node for the condition expression (AstGen.zig:6579).
|
||||
emitDbgNode(&cond_scope, cond_node);
|
||||
uint32_t cond = expr(&cond_scope, &cond_scope.base, cond_node);
|
||||
|
||||
// Create condbr + cond_block (AstGen.zig:6609-6615).
|
||||
|
||||
@@ -798,8 +798,8 @@ test "astgen: corpus tokenizer_test.zig" {
|
||||
}
|
||||
|
||||
test "astgen: corpus parser_test.zig" {
|
||||
// TODO: 1 inst diff — 1 STORE_NODE inside ptr-based struct init with
|
||||
// block field init expression.
|
||||
// TODO: int_type signedness data mismatch at inst[6899] — all tags and
|
||||
// inst_len match, but one int_type has ref=signed got=unsigned.
|
||||
if (true) return error.SkipZigTest;
|
||||
const gpa = std.testing.allocator;
|
||||
try corpusCheck(gpa, @embedFile("parser_test.zig"));
|
||||
|
||||
Reference in New Issue
Block a user