Skip to content

Commit 723d13f

Browse files
schmeemlugg
authored andcommitted
AstGen: fix OoB crash on ast-check -t
The `decl_node` was offset from the wrong source node.
1 parent 9dda2eb commit 723d13f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/AstGen.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -4298,7 +4298,7 @@ fn fnDecl(
42984298

42994299
if (!fn_gz.endsWithNoReturn()) {
43004300
// As our last action before the return, "pop" the error trace if needed
4301-
_ = try gz.addRestoreErrRetIndex(.ret, .always, decl_node);
4301+
_ = try fn_gz.addRestoreErrRetIndex(.ret, .always, decl_node);
43024302

43034303
// Add implicit return at end of function.
43044304
_ = try fn_gz.addUnTok(.ret_implicit, .void_value, tree.lastToken(body_node));
@@ -4746,7 +4746,7 @@ fn testDecl(
47464746
if (fn_block.isEmpty() or !fn_block.refIsNoReturn(block_result)) {
47474747

47484748
// As our last action before the return, "pop" the error trace if needed
4749-
_ = try gz.addRestoreErrRetIndex(.ret, .always, node);
4749+
_ = try fn_block.addRestoreErrRetIndex(.ret, .always, node);
47504750

47514751
// Add implicit return at end of function.
47524752
_ = try fn_block.addUnTok(.ret_implicit, .void_value, tree.lastToken(body_node));

0 commit comments

Comments
 (0)