zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a80960d00ab924e993dfce1facd78f0d6f534024 (tree)
parent fa3232cc1dfad4f3f684549bbc5790acefabb712
Author: Motiejus Jakštys <motiejus@jakstys.lt>
Date:   Tue, 17 Feb 2026 03:23:19 +0000

astgen: fix fnProtoExprInner lparen computation for named fn protos

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Diffstat:
Mstage0/astgen.c | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/stage0/astgen.c b/stage0/astgen.c @@ -6587,7 +6587,7 @@ static uint32_t fnProtoExprInner( uint32_t return_type_rhs = proto_data.rhs; if (proto_tag == AST_NODE_FN_PROTO_SIMPLE) { - if (proto_data.lhs != 0) { + if (proto_data.lhs != NULL_NODE) { param_nodes_buf[0] = proto_data.lhs; param_nodes = param_nodes_buf; params_len = 1; @@ -6595,7 +6595,7 @@ static uint32_t fnProtoExprInner( } else if (proto_tag == AST_NODE_FN_PROTO_ONE) { uint32_t extra_idx = proto_data.lhs; uint32_t param = tree->extra_data.arr[extra_idx]; - if (param != 0) { + if (param != NULL_NODE) { param_nodes_buf[0] = param; param_nodes = param_nodes_buf; params_len = 1; @@ -6628,7 +6628,10 @@ static uint32_t fnProtoExprInner( bool is_var_args = false; uint32_t fn_token = tree->nodes.main_tokens[node]; - uint32_t lparen = fn_token + 1; + uint32_t after_fn_token = fn_token + 1; + uint32_t lparen = (tree->tokens.tags[after_fn_token] == TOKEN_IDENTIFIER) + ? after_fn_token + 1 + : after_fn_token; uint32_t iter_tok_i = lparen + 1; bool iter_tok_flag = true; uint32_t iter_param_i = 0;