| ... | ... | @@ -2146,9 +2146,17 @@ pub const SrcLoc = struct { |
| 2146 | 2146 | const tree = try src_loc.file_scope.getTree(gpa); |
| 2147 | 2147 | const node = src_loc.declRelativeToNodeIndex(fn_proto_param.fn_proto_node_offset); |
| 2148 | 2148 | var buf: [1]Ast.Node.Index = undefined; |
| 2149 | | const fn_proto_full = tree.fullFnProto(&buf, node).?; |
| 2150 | | const src_node = fn_proto_full.ast.params[fn_proto_param.param_index]; |
| 2151 | | return nodeToSpan(tree, src_node); |
| 2149 | const full = tree.fullFnProto(&buf, node).?; |
| 2150 | var it = full.iterate(tree); |
| 2151 | var i: usize = 0; |
| 2152 | while (it.next()) |param| : (i += 1) { |
| 2153 | if (i == fn_proto_param.param_index) { |
| 2154 | if (param.anytype_ellipsis3) |token| return tokenToSpan(tree, token); |
| 2155 | if (param.name_token) |token| return tokenToSpan(tree, token); |
| 2156 | return nodeToSpan(tree, param.type_expr); |
| 2157 | } |
| 2158 | } |
| 2159 | unreachable; |
| 2152 | 2160 | }, |
| 2153 | 2161 | .node_offset_bin_lhs => |node_off| { |
| 2154 | 2162 | const tree = try src_loc.file_scope.getTree(gpa); |
| ... | ... | @@ -2502,6 +2510,10 @@ pub const SrcLoc = struct { |
| 2502 | 2510 | ); |
| 2503 | 2511 | } |
| 2504 | 2512 | |
| 2513 | fn tokenToSpan(tree: *const Ast, token: Ast.TokenIndex) Span { |
| 2514 | return tokensToSpan(tree, token, token, token); |
| 2515 | } |
| 2516 | |
| 2505 | 2517 | fn tokensToSpan(tree: *const Ast, start: Ast.TokenIndex, end: Ast.TokenIndex, main: Ast.TokenIndex) Span { |
| 2506 | 2518 | const token_starts = tree.tokens.items(.start); |
| 2507 | 2519 | var start_tok = start; |