| ... | ... | @@ -2133,10 +2133,40 @@ pub const SrcLoc = struct { |
| 2133 | 2133 | .call_arg => |call_arg| { |
| 2134 | 2134 | const tree = try src_loc.file_scope.getTree(gpa); |
| 2135 | 2135 | const node = src_loc.declRelativeToNodeIndex(call_arg.call_node_offset); |
| 2136 | | var buf: [1]Ast.Node.Index = undefined; |
| 2137 | | const call_full = tree.fullCall(&buf, node).?; |
| 2138 | | const src_node = call_full.ast.params[call_arg.arg_index]; |
| 2139 | | return nodeToSpan(tree, src_node); |
| 2136 | var buf: [2]Ast.Node.Index = undefined; |
| 2137 | const call_full = tree.fullCall(buf[0..1], node) orelse { |
| 2138 | const node_tags = tree.nodes.items(.tag); |
| 2139 | assert(node_tags[node] == .builtin_call); |
| 2140 | const call_args_node = tree.extra_data[tree.nodes.items(.data)[node].rhs - 1]; |
| 2141 | switch (node_tags[call_args_node]) { |
| 2142 | .array_init_one, |
| 2143 | .array_init_one_comma, |
| 2144 | .array_init_dot_two, |
| 2145 | .array_init_dot_two_comma, |
| 2146 | .array_init_dot, |
| 2147 | .array_init_dot_comma, |
| 2148 | .array_init, |
| 2149 | .array_init_comma, |
| 2150 | => { |
| 2151 | const full = tree.fullArrayInit(&buf, call_args_node).?.ast.elements; |
| 2152 | return nodeToSpan(tree, full[call_arg.arg_index]); |
| 2153 | }, |
| 2154 | .struct_init_one, |
| 2155 | .struct_init_one_comma, |
| 2156 | .struct_init_dot_two, |
| 2157 | .struct_init_dot_two_comma, |
| 2158 | .struct_init_dot, |
| 2159 | .struct_init_dot_comma, |
| 2160 | .struct_init, |
| 2161 | .struct_init_comma, |
| 2162 | => { |
| 2163 | const full = tree.fullStructInit(&buf, call_args_node).?.ast.fields; |
| 2164 | return nodeToSpan(tree, full[call_arg.arg_index]); |
| 2165 | }, |
| 2166 | else => return nodeToSpan(tree, call_args_node), |
| 2167 | } |
| 2168 | }; |
| 2169 | return nodeToSpan(tree, call_full.ast.params[call_arg.arg_index]); |
| 2140 | 2170 | }, |
| 2141 | 2171 | .fn_proto_param => |fn_proto_param| { |
| 2142 | 2172 | const tree = try src_loc.file_scope.getTree(gpa); |
| ... | ... | @@ -5926,21 +5956,15 @@ pub fn argSrc( |
| 5926 | 5956 | }); |
| 5927 | 5957 | return LazySrcLoc.nodeOffset(0); |
| 5928 | 5958 | }; |
| 5929 | | const node_tags = tree.nodes.items(.tag); |
| 5930 | 5959 | const node = decl.relativeToNodeIndex(call_node_offset); |
| 5931 | 5960 | var args: [1]Ast.Node.Index = undefined; |
| 5932 | | const full = switch (node_tags[node]) { |
| 5933 | | .call_one, .call_one_comma, .async_call_one, .async_call_one_comma => tree.callOne(&args, node), |
| 5934 | | .call, .call_comma, .async_call, .async_call_comma => tree.callFull(node), |
| 5935 | | .builtin_call => { |
| 5936 | | const node_datas = tree.nodes.items(.data); |
| 5937 | | const call_args_node = tree.extra_data[node_datas[node].rhs - 1]; |
| 5938 | | const call_args_offset = decl.nodeIndexToRelative(call_args_node); |
| 5939 | | return mod.initSrc(call_args_offset, decl, arg_i); |
| 5940 | | }, |
| 5941 | | else => unreachable, |
| 5961 | const call_full = tree.fullCall(&args, node) orelse { |
| 5962 | assert(tree.nodes.items(.tag)[node] == .builtin_call); |
| 5963 | const call_args_node = tree.extra_data[tree.nodes.items(.data)[node].rhs - 1]; |
| 5964 | const call_args_offset = decl.nodeIndexToRelative(call_args_node); |
| 5965 | return mod.initSrc(call_args_offset, decl, arg_i); |
| 5942 | 5966 | }; |
| 5943 | | return LazySrcLoc.nodeOffset(decl.nodeIndexToRelative(full.ast.params[arg_i])); |
| 5967 | return LazySrcLoc.nodeOffset(decl.nodeIndexToRelative(call_full.ast.params[arg_i])); |
| 5944 | 5968 | } |
| 5945 | 5969 | |
| 5946 | 5970 | pub fn initSrc( |