AstGen: fix OoB crash on ast-check -t

The `decl_node` was offset from the wrong source node.
This commit is contained in:
John Schmidt
2024-02-21 00:15:49 +01:00
committed by Matthew Lugg
parent 9dda2eb1ab
commit 723d13f831

View File

@@ -4298,7 +4298,7 @@ fn fnDecl(
if (!fn_gz.endsWithNoReturn()) {
// As our last action before the return, "pop" the error trace if needed
_ = try gz.addRestoreErrRetIndex(.ret, .always, decl_node);
_ = try fn_gz.addRestoreErrRetIndex(.ret, .always, decl_node);
// Add implicit return at end of function.
_ = try fn_gz.addUnTok(.ret_implicit, .void_value, tree.lastToken(body_node));
@@ -4746,7 +4746,7 @@ fn testDecl(
if (fn_block.isEmpty() or !fn_block.refIsNoReturn(block_result)) {
// As our last action before the return, "pop" the error trace if needed
_ = try gz.addRestoreErrRetIndex(.ret, .always, node);
_ = try fn_block.addRestoreErrRetIndex(.ret, .always, node);
// Add implicit return at end of function.
_ = try fn_block.addUnTok(.ret_implicit, .void_value, tree.lastToken(body_node));