| ... | ... | @@ -195,10 +195,14 @@ pub fn generateZirData(self: *Autodoc) !void { |
| 195 | 195 | ); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | | var root_scope = Scope{ .parent = null, .enclosing_type = main_type_index }; |
| 198 | var root_scope = Scope{ |
| 199 | .parent = null, |
| 200 | .enclosing_type = main_type_index, |
| 201 | }; |
| 202 | |
| 199 | 203 | try self.ast_nodes.append(self.arena, .{ .name = "(root)" }); |
| 200 | 204 | try self.files.put(self.arena, file, main_type_index); |
| 201 | | _ = try self.walkInstruction(file, &root_scope, Zir.main_struct_inst, false); |
| 205 | _ = try self.walkInstruction(file, &root_scope, 1, Zir.main_struct_inst, false); |
| 202 | 206 | |
| 203 | 207 | if (self.ref_paths_pending_on_decls.count() > 0) { |
| 204 | 208 | @panic("some decl paths were never fully analized (pending on decls)"); |
| ... | ... | @@ -769,6 +773,7 @@ fn walkInstruction( |
| 769 | 773 | self: *Autodoc, |
| 770 | 774 | file: *File, |
| 771 | 775 | parent_scope: *Scope, |
| 776 | parent_line: usize, |
| 772 | 777 | inst_index: usize, |
| 773 | 778 | need_type: bool, // true if the caller needs us to provide also a typeRef |
| 774 | 779 | ) AutodocErrors!DocData.WalkResult { |
| ... | ... | @@ -851,12 +856,16 @@ fn walkInstruction( |
| 851 | 856 | |
| 852 | 857 | const new_file = self.module.import_table.get(abs_root_src_path).?; |
| 853 | 858 | |
| 854 | | var root_scope = Scope{ .parent = null, .enclosing_type = main_type_index }; |
| 859 | var root_scope = Scope{ |
| 860 | .parent = null, |
| 861 | .enclosing_type = main_type_index, |
| 862 | }; |
| 855 | 863 | try self.ast_nodes.append(self.arena, .{ .name = "(root)" }); |
| 856 | 864 | try self.files.put(self.arena, new_file, main_type_index); |
| 857 | 865 | return self.walkInstruction( |
| 858 | 866 | new_file, |
| 859 | 867 | &root_scope, |
| 868 | 1, |
| 860 | 869 | Zir.main_struct_inst, |
| 861 | 870 | false, |
| 862 | 871 | ); |
| ... | ... | @@ -881,13 +890,14 @@ fn walkInstruction( |
| 881 | 890 | return self.walkInstruction( |
| 882 | 891 | new_file.file, |
| 883 | 892 | &new_scope, |
| 893 | 1, |
| 884 | 894 | Zir.main_struct_inst, |
| 885 | 895 | need_type, |
| 886 | 896 | ); |
| 887 | 897 | }, |
| 888 | 898 | .ret_node => { |
| 889 | 899 | const un_node = data[inst_index].un_node; |
| 890 | | return self.walkRef(file, parent_scope, un_node.operand, false); |
| 900 | return self.walkRef(file, parent_scope, parent_line, un_node.operand, false); |
| 891 | 901 | }, |
| 892 | 902 | .ret_load => { |
| 893 | 903 | const un_node = data[inst_index].un_node; |
| ... | ... | @@ -918,7 +928,7 @@ fn walkInstruction( |
| 918 | 928 | } |
| 919 | 929 | |
| 920 | 930 | if (result_ref) |rr| { |
| 921 | | return self.walkRef(file, parent_scope, rr, need_type); |
| 931 | return self.walkRef(file, parent_scope, parent_line, rr, need_type); |
| 922 | 932 | } |
| 923 | 933 | |
| 924 | 934 | return DocData.WalkResult{ |
| ... | ... | @@ -927,11 +937,11 @@ fn walkInstruction( |
| 927 | 937 | }, |
| 928 | 938 | .closure_get => { |
| 929 | 939 | const inst_node = data[inst_index].inst_node; |
| 930 | | return try self.walkInstruction(file, parent_scope, inst_node.inst, need_type); |
| 940 | return try self.walkInstruction(file, parent_scope, parent_line, inst_node.inst, need_type); |
| 931 | 941 | }, |
| 932 | 942 | .closure_capture => { |
| 933 | 943 | const un_tok = data[inst_index].un_tok; |
| 934 | | return try self.walkRef(file, parent_scope, un_tok.operand, need_type); |
| 944 | return try self.walkRef(file, parent_scope, parent_line, un_tok.operand, need_type); |
| 935 | 945 | }, |
| 936 | 946 | .cmpxchg_strong, .cmpxchg_weak => { |
| 937 | 947 | const pl_node = data[inst_index].pl_node; |
| ... | ... | @@ -946,6 +956,7 @@ fn walkInstruction( |
| 946 | 956 | var ptr: DocData.WalkResult = try self.walkRef( |
| 947 | 957 | file, |
| 948 | 958 | parent_scope, |
| 959 | parent_line, |
| 949 | 960 | extra.data.ptr, |
| 950 | 961 | false, |
| 951 | 962 | ); |
| ... | ... | @@ -955,6 +966,7 @@ fn walkInstruction( |
| 955 | 966 | var expected_value: DocData.WalkResult = try self.walkRef( |
| 956 | 967 | file, |
| 957 | 968 | parent_scope, |
| 969 | parent_line, |
| 958 | 970 | extra.data.expected_value, |
| 959 | 971 | false, |
| 960 | 972 | ); |
| ... | ... | @@ -964,6 +976,7 @@ fn walkInstruction( |
| 964 | 976 | var new_value: DocData.WalkResult = try self.walkRef( |
| 965 | 977 | file, |
| 966 | 978 | parent_scope, |
| 979 | parent_line, |
| 967 | 980 | extra.data.new_value, |
| 968 | 981 | false, |
| 969 | 982 | ); |
| ... | ... | @@ -973,6 +986,7 @@ fn walkInstruction( |
| 973 | 986 | var success_order: DocData.WalkResult = try self.walkRef( |
| 974 | 987 | file, |
| 975 | 988 | parent_scope, |
| 989 | parent_line, |
| 976 | 990 | extra.data.success_order, |
| 977 | 991 | false, |
| 978 | 992 | ); |
| ... | ... | @@ -982,6 +996,7 @@ fn walkInstruction( |
| 982 | 996 | var failure_order: DocData.WalkResult = try self.walkRef( |
| 983 | 997 | file, |
| 984 | 998 | parent_scope, |
| 999 | parent_line, |
| 985 | 1000 | extra.data.failure_order, |
| 986 | 1001 | false, |
| 987 | 1002 | ); |
| ... | ... | @@ -1035,6 +1050,7 @@ fn walkInstruction( |
| 1035 | 1050 | var operand: DocData.WalkResult = try self.walkRef( |
| 1036 | 1051 | file, |
| 1037 | 1052 | parent_scope, |
| 1053 | parent_line, |
| 1038 | 1054 | un_node.operand, |
| 1039 | 1055 | false, |
| 1040 | 1056 | ); |
| ... | ... | @@ -1089,12 +1105,14 @@ fn walkInstruction( |
| 1089 | 1105 | var lhs: DocData.WalkResult = try self.walkRef( |
| 1090 | 1106 | file, |
| 1091 | 1107 | parent_scope, |
| 1108 | parent_line, |
| 1092 | 1109 | extra.data.lhs, |
| 1093 | 1110 | false, |
| 1094 | 1111 | ); |
| 1095 | 1112 | var start: DocData.WalkResult = try self.walkRef( |
| 1096 | 1113 | file, |
| 1097 | 1114 | parent_scope, |
| 1115 | parent_line, |
| 1098 | 1116 | extra.data.start, |
| 1099 | 1117 | false, |
| 1100 | 1118 | ); |
| ... | ... | @@ -1120,18 +1138,21 @@ fn walkInstruction( |
| 1120 | 1138 | var lhs: DocData.WalkResult = try self.walkRef( |
| 1121 | 1139 | file, |
| 1122 | 1140 | parent_scope, |
| 1141 | parent_line, |
| 1123 | 1142 | extra.data.lhs, |
| 1124 | 1143 | false, |
| 1125 | 1144 | ); |
| 1126 | 1145 | var start: DocData.WalkResult = try self.walkRef( |
| 1127 | 1146 | file, |
| 1128 | 1147 | parent_scope, |
| 1148 | parent_line, |
| 1129 | 1149 | extra.data.start, |
| 1130 | 1150 | false, |
| 1131 | 1151 | ); |
| 1132 | 1152 | var end: DocData.WalkResult = try self.walkRef( |
| 1133 | 1153 | file, |
| 1134 | 1154 | parent_scope, |
| 1155 | parent_line, |
| 1135 | 1156 | extra.data.end, |
| 1136 | 1157 | false, |
| 1137 | 1158 | ); |
| ... | ... | @@ -1159,24 +1180,28 @@ fn walkInstruction( |
| 1159 | 1180 | var lhs: DocData.WalkResult = try self.walkRef( |
| 1160 | 1181 | file, |
| 1161 | 1182 | parent_scope, |
| 1183 | parent_line, |
| 1162 | 1184 | extra.data.lhs, |
| 1163 | 1185 | false, |
| 1164 | 1186 | ); |
| 1165 | 1187 | var start: DocData.WalkResult = try self.walkRef( |
| 1166 | 1188 | file, |
| 1167 | 1189 | parent_scope, |
| 1190 | parent_line, |
| 1168 | 1191 | extra.data.start, |
| 1169 | 1192 | false, |
| 1170 | 1193 | ); |
| 1171 | 1194 | var end: DocData.WalkResult = try self.walkRef( |
| 1172 | 1195 | file, |
| 1173 | 1196 | parent_scope, |
| 1197 | parent_line, |
| 1174 | 1198 | extra.data.end, |
| 1175 | 1199 | false, |
| 1176 | 1200 | ); |
| 1177 | 1201 | var sentinel: DocData.WalkResult = try self.walkRef( |
| 1178 | 1202 | file, |
| 1179 | 1203 | parent_scope, |
| 1204 | parent_line, |
| 1180 | 1205 | extra.data.sentinel, |
| 1181 | 1206 | false, |
| 1182 | 1207 | ); |
| ... | ... | @@ -1226,12 +1251,14 @@ fn walkInstruction( |
| 1226 | 1251 | var lhs: DocData.WalkResult = try self.walkRef( |
| 1227 | 1252 | file, |
| 1228 | 1253 | parent_scope, |
| 1254 | parent_line, |
| 1229 | 1255 | extra.data.lhs, |
| 1230 | 1256 | false, |
| 1231 | 1257 | ); |
| 1232 | 1258 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1233 | 1259 | file, |
| 1234 | 1260 | parent_scope, |
| 1261 | parent_line, |
| 1235 | 1262 | extra.data.rhs, |
| 1236 | 1263 | false, |
| 1237 | 1264 | ); |
| ... | ... | @@ -1292,7 +1319,7 @@ fn walkInstruction( |
| 1292 | 1319 | const un_node = data[inst_index].un_node; |
| 1293 | 1320 | const bin_index = self.exprs.items.len; |
| 1294 | 1321 | try self.exprs.append(self.arena, .{ .builtin = .{ .param = 0 } }); |
| 1295 | | const param = try self.walkRef(file, parent_scope, un_node.operand, false); |
| 1322 | const param = try self.walkRef(file, parent_scope, parent_line, un_node.operand, false); |
| 1296 | 1323 | |
| 1297 | 1324 | const param_index = self.exprs.items.len; |
| 1298 | 1325 | try self.exprs.append(self.arena, param.expr); |
| ... | ... | @@ -1341,12 +1368,14 @@ fn walkInstruction( |
| 1341 | 1368 | var lhs: DocData.WalkResult = try self.walkRef( |
| 1342 | 1369 | file, |
| 1343 | 1370 | parent_scope, |
| 1371 | parent_line, |
| 1344 | 1372 | extra.data.lhs, |
| 1345 | 1373 | false, |
| 1346 | 1374 | ); |
| 1347 | 1375 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1348 | 1376 | file, |
| 1349 | 1377 | parent_scope, |
| 1378 | parent_line, |
| 1350 | 1379 | extra.data.rhs, |
| 1351 | 1380 | false, |
| 1352 | 1381 | ); |
| ... | ... | @@ -1369,12 +1398,14 @@ fn walkInstruction( |
| 1369 | 1398 | var lhs: DocData.WalkResult = try self.walkRef( |
| 1370 | 1399 | file, |
| 1371 | 1400 | parent_scope, |
| 1401 | parent_line, |
| 1372 | 1402 | extra.data.lhs, |
| 1373 | 1403 | false, |
| 1374 | 1404 | ); |
| 1375 | 1405 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1376 | 1406 | file, |
| 1377 | 1407 | parent_scope, |
| 1408 | parent_line, |
| 1378 | 1409 | extra.data.rhs, |
| 1379 | 1410 | false, |
| 1380 | 1411 | ); |
| ... | ... | @@ -1397,12 +1428,14 @@ fn walkInstruction( |
| 1397 | 1428 | var lhs: DocData.WalkResult = try self.walkRef( |
| 1398 | 1429 | file, |
| 1399 | 1430 | parent_scope, |
| 1431 | parent_line, |
| 1400 | 1432 | extra.data.lhs, |
| 1401 | 1433 | false, |
| 1402 | 1434 | ); |
| 1403 | 1435 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1404 | 1436 | file, |
| 1405 | 1437 | parent_scope, |
| 1438 | parent_line, |
| 1406 | 1439 | extra.data.rhs, |
| 1407 | 1440 | false, |
| 1408 | 1441 | ); |
| ... | ... | @@ -1422,7 +1455,7 @@ fn walkInstruction( |
| 1422 | 1455 | |
| 1423 | 1456 | // var operand: DocData.WalkResult = try self.walkRef( |
| 1424 | 1457 | // file, |
| 1425 | | // parent_scope, |
| 1458 | // parent_scope, parent_line, |
| 1426 | 1459 | // un_node.operand, |
| 1427 | 1460 | // false, |
| 1428 | 1461 | // ); |
| ... | ... | @@ -1431,7 +1464,7 @@ fn walkInstruction( |
| 1431 | 1464 | // }, |
| 1432 | 1465 | .overflow_arithmetic_ptr => { |
| 1433 | 1466 | const un_node = data[inst_index].un_node; |
| 1434 | | const elem_type_ref = try self.walkRef(file, parent_scope, un_node.operand, false); |
| 1467 | const elem_type_ref = try self.walkRef(file, parent_scope, parent_line, un_node.operand, false); |
| 1435 | 1468 | const type_slot_index = self.types.items.len; |
| 1436 | 1469 | try self.types.append(self.arena, .{ |
| 1437 | 1470 | .Pointer = .{ |
| ... | ... | @@ -1456,6 +1489,7 @@ fn walkInstruction( |
| 1456 | 1489 | const elem_type_ref = try self.walkRef( |
| 1457 | 1490 | file, |
| 1458 | 1491 | parent_scope, |
| 1492 | parent_line, |
| 1459 | 1493 | extra.data.elem_type, |
| 1460 | 1494 | false, |
| 1461 | 1495 | ); |
| ... | ... | @@ -1465,7 +1499,7 @@ fn walkInstruction( |
| 1465 | 1499 | var sentinel: ?DocData.Expr = null; |
| 1466 | 1500 | if (ptr.flags.has_sentinel) { |
| 1467 | 1501 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1468 | | const ref_result = try self.walkRef(file, parent_scope, ref, false); |
| 1502 | const ref_result = try self.walkRef(file, parent_scope, parent_line, ref, false); |
| 1469 | 1503 | sentinel = ref_result.expr; |
| 1470 | 1504 | extra_index += 1; |
| 1471 | 1505 | } |
| ... | ... | @@ -1473,21 +1507,21 @@ fn walkInstruction( |
| 1473 | 1507 | var @"align": ?DocData.Expr = null; |
| 1474 | 1508 | if (ptr.flags.has_align) { |
| 1475 | 1509 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1476 | | const ref_result = try self.walkRef(file, parent_scope, ref, false); |
| 1510 | const ref_result = try self.walkRef(file, parent_scope, parent_line, ref, false); |
| 1477 | 1511 | @"align" = ref_result.expr; |
| 1478 | 1512 | extra_index += 1; |
| 1479 | 1513 | } |
| 1480 | 1514 | var address_space: ?DocData.Expr = null; |
| 1481 | 1515 | if (ptr.flags.has_addrspace) { |
| 1482 | 1516 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1483 | | const ref_result = try self.walkRef(file, parent_scope, ref, false); |
| 1517 | const ref_result = try self.walkRef(file, parent_scope, parent_line, ref, false); |
| 1484 | 1518 | address_space = ref_result.expr; |
| 1485 | 1519 | extra_index += 1; |
| 1486 | 1520 | } |
| 1487 | 1521 | var bit_start: ?DocData.Expr = null; |
| 1488 | 1522 | if (ptr.flags.has_bit_range) { |
| 1489 | 1523 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1490 | | const ref_result = try self.walkRef(file, parent_scope, ref, false); |
| 1524 | const ref_result = try self.walkRef(file, parent_scope, parent_line, ref, false); |
| 1491 | 1525 | address_space = ref_result.expr; |
| 1492 | 1526 | extra_index += 1; |
| 1493 | 1527 | } |
| ... | ... | @@ -1495,7 +1529,7 @@ fn walkInstruction( |
| 1495 | 1529 | var host_size: ?DocData.Expr = null; |
| 1496 | 1530 | if (ptr.flags.has_bit_range) { |
| 1497 | 1531 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1498 | | const ref_result = try self.walkRef(file, parent_scope, ref, false); |
| 1532 | const ref_result = try self.walkRef(file, parent_scope, parent_line, ref, false); |
| 1499 | 1533 | host_size = ref_result.expr; |
| 1500 | 1534 | } |
| 1501 | 1535 | |
| ... | ... | @@ -1525,8 +1559,8 @@ fn walkInstruction( |
| 1525 | 1559 | .array_type => { |
| 1526 | 1560 | const pl_node = data[inst_index].pl_node; |
| 1527 | 1561 | const bin = file.zir.extraData(Zir.Inst.Bin, pl_node.payload_index).data; |
| 1528 | | const len = try self.walkRef(file, parent_scope, bin.lhs, false); |
| 1529 | | const child = try self.walkRef(file, parent_scope, bin.rhs, false); |
| 1562 | const len = try self.walkRef(file, parent_scope, parent_line, bin.lhs, false); |
| 1563 | const child = try self.walkRef(file, parent_scope, parent_line, bin.rhs, false); |
| 1530 | 1564 | |
| 1531 | 1565 | const type_slot_index = self.types.items.len; |
| 1532 | 1566 | try self.types.append(self.arena, .{ |
| ... | ... | @@ -1544,9 +1578,9 @@ fn walkInstruction( |
| 1544 | 1578 | .array_type_sentinel => { |
| 1545 | 1579 | const pl_node = data[inst_index].pl_node; |
| 1546 | 1580 | const extra = file.zir.extraData(Zir.Inst.ArrayTypeSentinel, pl_node.payload_index); |
| 1547 | | const len = try self.walkRef(file, parent_scope, extra.data.len, false); |
| 1548 | | const sentinel = try self.walkRef(file, parent_scope, extra.data.sentinel, false); |
| 1549 | | const elem_type = try self.walkRef(file, parent_scope, extra.data.elem_type, false); |
| 1581 | const len = try self.walkRef(file, parent_scope, parent_line, extra.data.len, false); |
| 1582 | const sentinel = try self.walkRef(file, parent_scope, parent_line, extra.data.sentinel, false); |
| 1583 | const elem_type = try self.walkRef(file, parent_scope, parent_line, extra.data.elem_type, false); |
| 1550 | 1584 | |
| 1551 | 1585 | const type_slot_index = self.types.items.len; |
| 1552 | 1586 | try self.types.append(self.arena, .{ |
| ... | ... | @@ -1568,10 +1602,10 @@ fn walkInstruction( |
| 1568 | 1602 | const array_data = try self.arena.alloc(usize, operands.len - 1); |
| 1569 | 1603 | |
| 1570 | 1604 | std.debug.assert(operands.len > 0); |
| 1571 | | var array_type = try self.walkRef(file, parent_scope, operands[0], false); |
| 1605 | var array_type = try self.walkRef(file, parent_scope, parent_line, operands[0], false); |
| 1572 | 1606 | |
| 1573 | 1607 | for (operands[1..]) |op, idx| { |
| 1574 | | const wr = try self.walkRef(file, parent_scope, op, false); |
| 1608 | const wr = try self.walkRef(file, parent_scope, parent_line, op, false); |
| 1575 | 1609 | const expr_index = self.exprs.items.len; |
| 1576 | 1610 | try self.exprs.append(self.arena, wr.expr); |
| 1577 | 1611 | array_data[idx] = expr_index; |
| ... | ... | @@ -1589,7 +1623,7 @@ fn walkInstruction( |
| 1589 | 1623 | const array_data = try self.arena.alloc(usize, operands.len); |
| 1590 | 1624 | |
| 1591 | 1625 | for (operands) |op, idx| { |
| 1592 | | const wr = try self.walkRef(file, parent_scope, op, false); |
| 1626 | const wr = try self.walkRef(file, parent_scope, parent_line, op, false); |
| 1593 | 1627 | const expr_index = self.exprs.items.len; |
| 1594 | 1628 | try self.exprs.append(self.arena, wr.expr); |
| 1595 | 1629 | array_data[idx] = expr_index; |
| ... | ... | @@ -1607,10 +1641,10 @@ fn walkInstruction( |
| 1607 | 1641 | const array_data = try self.arena.alloc(usize, operands.len - 1); |
| 1608 | 1642 | |
| 1609 | 1643 | std.debug.assert(operands.len > 0); |
| 1610 | | var array_type = try self.walkRef(file, parent_scope, operands[0], false); |
| 1644 | var array_type = try self.walkRef(file, parent_scope, parent_line, operands[0], false); |
| 1611 | 1645 | |
| 1612 | 1646 | for (operands[1..]) |op, idx| { |
| 1613 | | const wr = try self.walkRef(file, parent_scope, op, false); |
| 1647 | const wr = try self.walkRef(file, parent_scope, parent_line, op, false); |
| 1614 | 1648 | const expr_index = self.exprs.items.len; |
| 1615 | 1649 | try self.exprs.append(self.arena, wr.expr); |
| 1616 | 1650 | array_data[idx] = expr_index; |
| ... | ... | @@ -1639,7 +1673,7 @@ fn walkInstruction( |
| 1639 | 1673 | const array_data = try self.arena.alloc(usize, operands.len); |
| 1640 | 1674 | |
| 1641 | 1675 | for (operands) |op, idx| { |
| 1642 | | const wr = try self.walkRef(file, parent_scope, op, false); |
| 1676 | const wr = try self.walkRef(file, parent_scope, parent_line, op, false); |
| 1643 | 1677 | const expr_index = self.exprs.items.len; |
| 1644 | 1678 | try self.exprs.append(self.arena, wr.expr); |
| 1645 | 1679 | array_data[idx] = expr_index; |
| ... | ... | @@ -1674,6 +1708,7 @@ fn walkInstruction( |
| 1674 | 1708 | var operand: DocData.WalkResult = try self.walkRef( |
| 1675 | 1709 | file, |
| 1676 | 1710 | parent_scope, |
| 1711 | parent_line, |
| 1677 | 1712 | un_node.operand, |
| 1678 | 1713 | need_type, |
| 1679 | 1714 | ); |
| ... | ... | @@ -1695,6 +1730,7 @@ fn walkInstruction( |
| 1695 | 1730 | const operand = try self.walkRef( |
| 1696 | 1731 | file, |
| 1697 | 1732 | parent_scope, |
| 1733 | parent_line, |
| 1698 | 1734 | un_node.operand, |
| 1699 | 1735 | false, |
| 1700 | 1736 | ); |
| ... | ... | @@ -1711,6 +1747,7 @@ fn walkInstruction( |
| 1711 | 1747 | const operand = try self.walkRef( |
| 1712 | 1748 | file, |
| 1713 | 1749 | parent_scope, |
| 1750 | parent_line, |
| 1714 | 1751 | un_node.operand, |
| 1715 | 1752 | need_type, |
| 1716 | 1753 | ); |
| ... | ... | @@ -1728,6 +1765,7 @@ fn walkInstruction( |
| 1728 | 1765 | const operand = try self.walkRef( |
| 1729 | 1766 | file, |
| 1730 | 1767 | parent_scope, |
| 1768 | parent_line, |
| 1731 | 1769 | un_node.operand, |
| 1732 | 1770 | false, |
| 1733 | 1771 | ); |
| ... | ... | @@ -1744,7 +1782,7 @@ fn walkInstruction( |
| 1744 | 1782 | const pl_node = data[inst_index].pl_node; |
| 1745 | 1783 | const extra = file.zir.extraData(Zir.Inst.SwitchBlock, pl_node.payload_index); |
| 1746 | 1784 | const cond_index = self.exprs.items.len; |
| 1747 | | _ = try self.walkRef(file, parent_scope, extra.data.operand, false); |
| 1785 | _ = try self.walkRef(file, parent_scope, parent_line, extra.data.operand, false); |
| 1748 | 1786 | |
| 1749 | 1787 | const ast_index = self.ast_nodes.items.len; |
| 1750 | 1788 | const type_index = self.types.items.len - 1; |
| ... | ... | @@ -1772,6 +1810,7 @@ fn walkInstruction( |
| 1772 | 1810 | const operand = try self.walkRef( |
| 1773 | 1811 | file, |
| 1774 | 1812 | parent_scope, |
| 1813 | parent_line, |
| 1775 | 1814 | un_node.operand, |
| 1776 | 1815 | need_type, |
| 1777 | 1816 | ); |
| ... | ... | @@ -1797,6 +1836,7 @@ fn walkInstruction( |
| 1797 | 1836 | const operand = try self.walkRef( |
| 1798 | 1837 | file, |
| 1799 | 1838 | parent_scope, |
| 1839 | parent_line, |
| 1800 | 1840 | un_node.operand, |
| 1801 | 1841 | need_type, |
| 1802 | 1842 | ); |
| ... | ... | @@ -1816,6 +1856,7 @@ fn walkInstruction( |
| 1816 | 1856 | var operand: DocData.WalkResult = try self.walkRef( |
| 1817 | 1857 | file, |
| 1818 | 1858 | parent_scope, |
| 1859 | parent_line, |
| 1819 | 1860 | data[body].@"break".operand, |
| 1820 | 1861 | false, |
| 1821 | 1862 | ); |
| ... | ... | @@ -1834,6 +1875,7 @@ fn walkInstruction( |
| 1834 | 1875 | const operand = try self.walkRef( |
| 1835 | 1876 | file, |
| 1836 | 1877 | parent_scope, |
| 1878 | parent_line, |
| 1837 | 1879 | un_node.operand, |
| 1838 | 1880 | need_type, |
| 1839 | 1881 | ); |
| ... | ... | @@ -1852,6 +1894,7 @@ fn walkInstruction( |
| 1852 | 1894 | const dest_type_walk = try self.walkRef( |
| 1853 | 1895 | file, |
| 1854 | 1896 | parent_scope, |
| 1897 | parent_line, |
| 1855 | 1898 | extra.data.dest_type, |
| 1856 | 1899 | false, |
| 1857 | 1900 | ); |
| ... | ... | @@ -1859,6 +1902,7 @@ fn walkInstruction( |
| 1859 | 1902 | const operand = try self.walkRef( |
| 1860 | 1903 | file, |
| 1861 | 1904 | parent_scope, |
| 1905 | parent_line, |
| 1862 | 1906 | extra.data.operand, |
| 1863 | 1907 | false, |
| 1864 | 1908 | ); |
| ... | ... | @@ -1886,6 +1930,7 @@ fn walkInstruction( |
| 1886 | 1930 | const operand: DocData.WalkResult = try self.walkRef( |
| 1887 | 1931 | file, |
| 1888 | 1932 | parent_scope, |
| 1933 | parent_line, |
| 1889 | 1934 | un_node.operand, |
| 1890 | 1935 | false, |
| 1891 | 1936 | ); |
| ... | ... | @@ -1969,7 +2014,7 @@ fn walkInstruction( |
| 1969 | 2014 | } |
| 1970 | 2015 | } |
| 1971 | 2016 | |
| 1972 | | break :blk try self.walkRef(file, parent_scope, lhs_ref, false); |
| 2017 | break :blk try self.walkRef(file, parent_scope, parent_line, lhs_ref, false); |
| 1973 | 2018 | }; |
| 1974 | 2019 | try path.append(self.arena, wr.expr); |
| 1975 | 2020 | |
| ... | ... | @@ -2020,6 +2065,7 @@ fn walkInstruction( |
| 2020 | 2065 | return self.walkRef( |
| 2021 | 2066 | file, |
| 2022 | 2067 | parent_scope, |
| 2068 | parent_line, |
| 2023 | 2069 | getBlockInlineBreak(file.zir, inst_index), |
| 2024 | 2070 | need_type, |
| 2025 | 2071 | ); |
| ... | ... | @@ -2052,6 +2098,7 @@ fn walkInstruction( |
| 2052 | 2098 | const wr = try self.walkRef( |
| 2053 | 2099 | file, |
| 2054 | 2100 | parent_scope, |
| 2101 | parent_line, |
| 2055 | 2102 | field_extra.data.container_type, |
| 2056 | 2103 | false, |
| 2057 | 2104 | ); |
| ... | ... | @@ -2062,6 +2109,7 @@ fn walkInstruction( |
| 2062 | 2109 | const value = try self.walkRef( |
| 2063 | 2110 | file, |
| 2064 | 2111 | parent_scope, |
| 2112 | parent_line, |
| 2065 | 2113 | init_extra.data.init, |
| 2066 | 2114 | need_type, |
| 2067 | 2115 | ); |
| ... | ... | @@ -2078,6 +2126,7 @@ fn walkInstruction( |
| 2078 | 2126 | var operand: DocData.WalkResult = try self.walkRef( |
| 2079 | 2127 | file, |
| 2080 | 2128 | parent_scope, |
| 2129 | parent_line, |
| 2081 | 2130 | un_node.operand, |
| 2082 | 2131 | false, |
| 2083 | 2132 | ); |
| ... | ... | @@ -2110,6 +2159,7 @@ fn walkInstruction( |
| 2110 | 2159 | const value = try self.walkRef( |
| 2111 | 2160 | file, |
| 2112 | 2161 | parent_scope, |
| 2162 | parent_line, |
| 2113 | 2163 | init_extra.data.init, |
| 2114 | 2164 | need_type, |
| 2115 | 2165 | ); |
| ... | ... | @@ -2185,7 +2235,7 @@ fn walkInstruction( |
| 2185 | 2235 | const pl_node = data[inst_index].pl_node; |
| 2186 | 2236 | const extra = file.zir.extraData(Zir.Inst.Call, pl_node.payload_index); |
| 2187 | 2237 | |
| 2188 | | const callee = try self.walkRef(file, parent_scope, extra.data.callee, need_type); |
| 2238 | const callee = try self.walkRef(file, parent_scope, parent_line, extra.data.callee, need_type); |
| 2189 | 2239 | |
| 2190 | 2240 | const args_len = extra.data.flags.args_len; |
| 2191 | 2241 | var args = try self.arena.alloc(DocData.Expr, args_len); |
| ... | ... | @@ -2200,7 +2250,7 @@ fn walkInstruction( |
| 2200 | 2250 | // to show discrepancies between the types of provided |
| 2201 | 2251 | // arguments and the types declared in the function |
| 2202 | 2252 | // signature for its parameters. |
| 2203 | | const wr = try self.walkRef(file, parent_scope, ref, false); |
| 2253 | const wr = try self.walkRef(file, parent_scope, parent_line, ref, false); |
| 2204 | 2254 | args[i] = wr.expr; |
| 2205 | 2255 | } |
| 2206 | 2256 | |
| ... | ... | @@ -2231,6 +2281,7 @@ fn walkInstruction( |
| 2231 | 2281 | const result = self.analyzeFunction( |
| 2232 | 2282 | file, |
| 2233 | 2283 | parent_scope, |
| 2284 | parent_line, |
| 2234 | 2285 | inst_index, |
| 2235 | 2286 | self_ast_node_index, |
| 2236 | 2287 | type_slot_index, |
| ... | ... | @@ -2246,6 +2297,7 @@ fn walkInstruction( |
| 2246 | 2297 | const result = self.analyzeFancyFunction( |
| 2247 | 2298 | file, |
| 2248 | 2299 | parent_scope, |
| 2300 | parent_line, |
| 2249 | 2301 | inst_index, |
| 2250 | 2302 | self_ast_node_index, |
| 2251 | 2303 | type_slot_index, |
| ... | ... | @@ -2273,7 +2325,7 @@ fn walkInstruction( |
| 2273 | 2325 | |
| 2274 | 2326 | var array_type: ?DocData.Expr = null; |
| 2275 | 2327 | for (args) |arg, idx| { |
| 2276 | | const wr = try self.walkRef(file, parent_scope, arg, idx == 0); |
| 2328 | const wr = try self.walkRef(file, parent_scope, parent_line, arg, idx == 0); |
| 2277 | 2329 | if (idx == 0) { |
| 2278 | 2330 | array_type = wr.typeRef; |
| 2279 | 2331 | } |
| ... | ... | @@ -2418,6 +2470,7 @@ fn walkInstruction( |
| 2418 | 2470 | extra_index = try self.walkDecls( |
| 2419 | 2471 | file, |
| 2420 | 2472 | &scope, |
| 2473 | parent_line, |
| 2421 | 2474 | decls_first_index, |
| 2422 | 2475 | decls_len, |
| 2423 | 2476 | &decl_indexes, |
| ... | ... | @@ -2438,6 +2491,7 @@ fn walkInstruction( |
| 2438 | 2491 | try self.collectUnionFieldInfo( |
| 2439 | 2492 | file, |
| 2440 | 2493 | &scope, |
| 2494 | parent_line, |
| 2441 | 2495 | fields_len, |
| 2442 | 2496 | &field_type_refs, |
| 2443 | 2497 | &field_name_indexes, |
| ... | ... | @@ -2538,6 +2592,7 @@ fn walkInstruction( |
| 2538 | 2592 | extra_index = try self.walkDecls( |
| 2539 | 2593 | file, |
| 2540 | 2594 | &scope, |
| 2595 | parent_line, |
| 2541 | 2596 | decls_first_index, |
| 2542 | 2597 | decls_len, |
| 2543 | 2598 | &decl_indexes, |
| ... | ... | @@ -2681,6 +2736,7 @@ fn walkInstruction( |
| 2681 | 2736 | extra_index = try self.walkDecls( |
| 2682 | 2737 | file, |
| 2683 | 2738 | &scope, |
| 2739 | parent_line, |
| 2684 | 2740 | decls_first_index, |
| 2685 | 2741 | decls_len, |
| 2686 | 2742 | &decl_indexes, |
| ... | ... | @@ -2693,6 +2749,7 @@ fn walkInstruction( |
| 2693 | 2749 | try self.collectStructFieldInfo( |
| 2694 | 2750 | file, |
| 2695 | 2751 | &scope, |
| 2752 | parent_line, |
| 2696 | 2753 | fields_len, |
| 2697 | 2754 | &field_type_refs, |
| 2698 | 2755 | &field_name_indexes, |
| ... | ... | @@ -2736,7 +2793,7 @@ fn walkInstruction( |
| 2736 | 2793 | const extra = file.zir.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 2737 | 2794 | const bin_index = self.exprs.items.len; |
| 2738 | 2795 | try self.exprs.append(self.arena, .{ .builtin = .{ .param = 0 } }); |
| 2739 | | const param = try self.walkRef(file, parent_scope, extra.operand, false); |
| 2796 | const param = try self.walkRef(file, parent_scope, parent_line, extra.operand, false); |
| 2740 | 2797 | |
| 2741 | 2798 | const param_index = self.exprs.items.len; |
| 2742 | 2799 | try self.exprs.append(self.arena, param.expr); |
| ... | ... | @@ -2764,6 +2821,7 @@ fn walkDecls( |
| 2764 | 2821 | self: *Autodoc, |
| 2765 | 2822 | file: *File, |
| 2766 | 2823 | scope: *Scope, |
| 2824 | parent_line: usize, |
| 2767 | 2825 | decls_first_index: usize, |
| 2768 | 2826 | decls_len: u32, |
| 2769 | 2827 | decl_indexes: *std.ArrayListUnmanaged(usize), |
| ... | ... | @@ -2796,7 +2854,7 @@ fn walkDecls( |
| 2796 | 2854 | |
| 2797 | 2855 | // const hash_u32s = file.zir.extra[extra_index..][0..4]; |
| 2798 | 2856 | extra_index += 4; |
| 2799 | | const line = file.zir.extra[extra_index]; |
| 2857 | const line = parent_line + file.zir.extra[extra_index]; |
| 2800 | 2858 | extra_index += 1; |
| 2801 | 2859 | const decl_name_index = file.zir.extra[extra_index]; |
| 2802 | 2860 | extra_index += 1; |
| ... | ... | @@ -2936,7 +2994,7 @@ fn walkDecls( |
| 2936 | 2994 | const idx = self.ast_nodes.items.len; |
| 2937 | 2995 | try self.ast_nodes.append(self.arena, .{ |
| 2938 | 2996 | .file = self.files.getIndex(file) orelse unreachable, |
| 2939 | | .line = line, // TODO: calculate absolute line |
| 2997 | .line = line, |
| 2940 | 2998 | .col = 0, |
| 2941 | 2999 | .docs = doc_comment, |
| 2942 | 3000 | .fields = null, // walkInstruction will fill `fields` if necessary |
| ... | ... | @@ -2947,7 +3005,7 @@ fn walkDecls( |
| 2947 | 3005 | const walk_result = if (is_test) // TODO: decide if tests should show up at all |
| 2948 | 3006 | DocData.WalkResult{ .expr = .{ .void = .{} } } |
| 2949 | 3007 | else |
| 2950 | | try self.walkInstruction(file, scope, value_index, true); |
| 3008 | try self.walkInstruction(file, scope, line, value_index, true); |
| 2951 | 3009 | |
| 2952 | 3010 | if (is_pub) { |
| 2953 | 3011 | try decl_indexes.append(self.arena, decls_slot_index); |
| ... | ... | @@ -3343,6 +3401,7 @@ fn analyzeFancyFunction( |
| 3343 | 3401 | self: *Autodoc, |
| 3344 | 3402 | file: *File, |
| 3345 | 3403 | scope: *Scope, |
| 3404 | parent_line: usize, |
| 3346 | 3405 | inst_index: usize, |
| 3347 | 3406 | self_ast_node_index: usize, |
| 3348 | 3407 | type_slot_index: usize, |
| ... | ... | @@ -3407,7 +3466,7 @@ fn analyzeFancyFunction( |
| 3407 | 3466 | |
| 3408 | 3467 | const break_index = file.zir.extra[extra.end..][extra.data.body_len - 1]; |
| 3409 | 3468 | const break_operand = data[break_index].@"break".operand; |
| 3410 | | const param_type_ref = try self.walkRef(file, scope, break_operand, false); |
| 3469 | const param_type_ref = try self.walkRef(file, scope, parent_line, break_operand, false); |
| 3411 | 3470 | |
| 3412 | 3471 | param_type_refs.appendAssumeCapacity(param_type_ref.expr); |
| 3413 | 3472 | }, |
| ... | ... | @@ -3431,7 +3490,7 @@ fn analyzeFancyFunction( |
| 3431 | 3490 | if (extra.data.bits.has_align_ref) { |
| 3432 | 3491 | const align_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 3433 | 3492 | align_index = self.exprs.items.len; |
| 3434 | | _ = try self.walkRef(file, scope, align_ref, false); |
| 3493 | _ = try self.walkRef(file, scope, parent_line, align_ref, false); |
| 3435 | 3494 | extra_index += 1; |
| 3436 | 3495 | } else if (extra.data.bits.has_align_body) { |
| 3437 | 3496 | const align_body_len = file.zir.extra[extra_index]; |
| ... | ... | @@ -3448,7 +3507,7 @@ fn analyzeFancyFunction( |
| 3448 | 3507 | if (extra.data.bits.has_addrspace_ref) { |
| 3449 | 3508 | const addrspace_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 3450 | 3509 | addrspace_index = self.exprs.items.len; |
| 3451 | | _ = try self.walkRef(file, scope, addrspace_ref, false); |
| 3510 | _ = try self.walkRef(file, scope, parent_line, addrspace_ref, false); |
| 3452 | 3511 | extra_index += 1; |
| 3453 | 3512 | } else if (extra.data.bits.has_addrspace_body) { |
| 3454 | 3513 | const addrspace_body_len = file.zir.extra[extra_index]; |
| ... | ... | @@ -3465,7 +3524,7 @@ fn analyzeFancyFunction( |
| 3465 | 3524 | if (extra.data.bits.has_section_ref) { |
| 3466 | 3525 | const section_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 3467 | 3526 | section_index = self.exprs.items.len; |
| 3468 | | _ = try self.walkRef(file, scope, section_ref, false); |
| 3527 | _ = try self.walkRef(file, scope, parent_line, section_ref, false); |
| 3469 | 3528 | extra_index += 1; |
| 3470 | 3529 | } else if (extra.data.bits.has_section_body) { |
| 3471 | 3530 | const section_body_len = file.zir.extra[extra_index]; |
| ... | ... | @@ -3482,7 +3541,7 @@ fn analyzeFancyFunction( |
| 3482 | 3541 | if (extra.data.bits.has_cc_ref) { |
| 3483 | 3542 | const cc_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 3484 | 3543 | cc_index = self.exprs.items.len; |
| 3485 | | _ = try self.walkRef(file, scope, cc_ref, false); |
| 3544 | _ = try self.walkRef(file, scope, parent_line, cc_ref, false); |
| 3486 | 3545 | extra_index += 1; |
| 3487 | 3546 | } else if (extra.data.bits.has_cc_body) { |
| 3488 | 3547 | const cc_body_len = file.zir.extra[extra_index]; |
| ... | ... | @@ -3501,14 +3560,14 @@ fn analyzeFancyFunction( |
| 3501 | 3560 | .none => DocData.Expr{ .void = .{} }, |
| 3502 | 3561 | else => blk: { |
| 3503 | 3562 | const ref = fn_info.ret_ty_ref; |
| 3504 | | const wr = try self.walkRef(file, scope, ref, false); |
| 3563 | const wr = try self.walkRef(file, scope, parent_line, ref, false); |
| 3505 | 3564 | break :blk wr.expr; |
| 3506 | 3565 | }, |
| 3507 | 3566 | }, |
| 3508 | 3567 | else => blk: { |
| 3509 | 3568 | const last_instr_index = fn_info.ret_ty_body[fn_info.ret_ty_body.len - 1]; |
| 3510 | 3569 | const break_operand = data[last_instr_index].@"break".operand; |
| 3511 | | const wr = try self.walkRef(file, scope, break_operand, false); |
| 3570 | const wr = try self.walkRef(file, scope, parent_line, break_operand, false); |
| 3512 | 3571 | break :blk wr.expr; |
| 3513 | 3572 | }, |
| 3514 | 3573 | }; |
| ... | ... | @@ -3523,6 +3582,7 @@ fn analyzeFancyFunction( |
| 3523 | 3582 | break :blk try self.getGenericReturnType( |
| 3524 | 3583 | file, |
| 3525 | 3584 | scope, |
| 3585 | parent_line, |
| 3526 | 3586 | fn_info.body[fn_info.body.len - 1], |
| 3527 | 3587 | ); |
| 3528 | 3588 | } else { |
| ... | ... | @@ -3559,6 +3619,7 @@ fn analyzeFunction( |
| 3559 | 3619 | self: *Autodoc, |
| 3560 | 3620 | file: *File, |
| 3561 | 3621 | scope: *Scope, |
| 3622 | parent_line: usize, |
| 3562 | 3623 | inst_index: usize, |
| 3563 | 3624 | self_ast_node_index: usize, |
| 3564 | 3625 | type_slot_index: usize, |
| ... | ... | @@ -3624,7 +3685,7 @@ fn analyzeFunction( |
| 3624 | 3685 | |
| 3625 | 3686 | const break_index = file.zir.extra[extra.end..][extra.data.body_len - 1]; |
| 3626 | 3687 | const break_operand = data[break_index].@"break".operand; |
| 3627 | | const param_type_ref = try self.walkRef(file, scope, break_operand, false); |
| 3688 | const param_type_ref = try self.walkRef(file, scope, parent_line, break_operand, false); |
| 3628 | 3689 | |
| 3629 | 3690 | param_type_refs.appendAssumeCapacity(param_type_ref.expr); |
| 3630 | 3691 | }, |
| ... | ... | @@ -3637,14 +3698,14 @@ fn analyzeFunction( |
| 3637 | 3698 | .none => DocData.Expr{ .void = .{} }, |
| 3638 | 3699 | else => blk: { |
| 3639 | 3700 | const ref = fn_info.ret_ty_ref; |
| 3640 | | const wr = try self.walkRef(file, scope, ref, false); |
| 3701 | const wr = try self.walkRef(file, scope, parent_line, ref, false); |
| 3641 | 3702 | break :blk wr.expr; |
| 3642 | 3703 | }, |
| 3643 | 3704 | }, |
| 3644 | 3705 | else => blk: { |
| 3645 | 3706 | const last_instr_index = fn_info.ret_ty_body[fn_info.ret_ty_body.len - 1]; |
| 3646 | 3707 | const break_operand = data[last_instr_index].@"break".operand; |
| 3647 | | const wr = try self.walkRef(file, scope, break_operand, false); |
| 3708 | const wr = try self.walkRef(file, scope, parent_line, break_operand, false); |
| 3648 | 3709 | break :blk wr.expr; |
| 3649 | 3710 | }, |
| 3650 | 3711 | }; |
| ... | ... | @@ -3659,6 +3720,7 @@ fn analyzeFunction( |
| 3659 | 3720 | break :blk try self.getGenericReturnType( |
| 3660 | 3721 | file, |
| 3661 | 3722 | scope, |
| 3723 | parent_line, |
| 3662 | 3724 | fn_info.body[fn_info.body.len - 1], |
| 3663 | 3725 | ); |
| 3664 | 3726 | } else { |
| ... | ... | @@ -3699,9 +3761,11 @@ fn getGenericReturnType( |
| 3699 | 3761 | self: *Autodoc, |
| 3700 | 3762 | file: *File, |
| 3701 | 3763 | scope: *Scope, |
| 3764 | parent_line: usize, // function decl line |
| 3702 | 3765 | body_end: usize, |
| 3703 | 3766 | ) !DocData.Expr { |
| 3704 | | const wr = try self.walkInstruction(file, scope, body_end, false); |
| 3767 | // TODO: compute the correct line offset |
| 3768 | const wr = try self.walkInstruction(file, scope, parent_line, body_end, false); |
| 3705 | 3769 | return wr.expr; |
| 3706 | 3770 | } |
| 3707 | 3771 | |
| ... | ... | @@ -3709,6 +3773,7 @@ fn collectUnionFieldInfo( |
| 3709 | 3773 | self: *Autodoc, |
| 3710 | 3774 | file: *File, |
| 3711 | 3775 | scope: *Scope, |
| 3776 | parent_line: usize, |
| 3712 | 3777 | fields_len: usize, |
| 3713 | 3778 | field_type_refs: *std.ArrayListUnmanaged(DocData.Expr), |
| 3714 | 3779 | field_name_indexes: *std.ArrayListUnmanaged(usize), |
| ... | ... | @@ -3755,7 +3820,7 @@ fn collectUnionFieldInfo( |
| 3755 | 3820 | |
| 3756 | 3821 | // type |
| 3757 | 3822 | { |
| 3758 | | const walk_result = try self.walkRef(file, scope, field_type, false); |
| 3823 | const walk_result = try self.walkRef(file, scope, parent_line, field_type, false); |
| 3759 | 3824 | try field_type_refs.append(self.arena, walk_result.expr); |
| 3760 | 3825 | } |
| 3761 | 3826 | |
| ... | ... | @@ -3778,6 +3843,7 @@ fn collectStructFieldInfo( |
| 3778 | 3843 | self: *Autodoc, |
| 3779 | 3844 | file: *File, |
| 3780 | 3845 | scope: *Scope, |
| 3846 | parent_line: usize, |
| 3781 | 3847 | fields_len: usize, |
| 3782 | 3848 | field_type_refs: *std.ArrayListUnmanaged(DocData.Expr), |
| 3783 | 3849 | field_name_indexes: *std.ArrayListUnmanaged(usize), |
| ... | ... | @@ -3851,7 +3917,7 @@ fn collectStructFieldInfo( |
| 3851 | 3917 | for (fields) |field| { |
| 3852 | 3918 | const type_expr = expr: { |
| 3853 | 3919 | if (field.type_ref != .none) { |
| 3854 | | const walk_result = try self.walkRef(file, scope, field.type_ref, false); |
| 3920 | const walk_result = try self.walkRef(file, scope, parent_line, field.type_ref, false); |
| 3855 | 3921 | break :expr walk_result.expr; |
| 3856 | 3922 | } |
| 3857 | 3923 | |
| ... | ... | @@ -3861,7 +3927,7 @@ fn collectStructFieldInfo( |
| 3861 | 3927 | |
| 3862 | 3928 | const break_inst = body[body.len - 1]; |
| 3863 | 3929 | const operand = data[break_inst].@"break".operand; |
| 3864 | | const walk_result = try self.walkRef(file, scope, operand, false); |
| 3930 | const walk_result = try self.walkRef(file, scope, parent_line, operand, false); |
| 3865 | 3931 | break :expr walk_result.expr; |
| 3866 | 3932 | }; |
| 3867 | 3933 | |
| ... | ... | @@ -3891,6 +3957,7 @@ fn walkRef( |
| 3891 | 3957 | self: *Autodoc, |
| 3892 | 3958 | file: *File, |
| 3893 | 3959 | parent_scope: *Scope, |
| 3960 | parent_line: usize, |
| 3894 | 3961 | ref: Ref, |
| 3895 | 3962 | need_type: bool, // true when the caller needs also a typeRef for the return value |
| 3896 | 3963 | ) AutodocErrors!DocData.WalkResult { |
| ... | ... | @@ -4002,7 +4069,7 @@ fn walkRef( |
| 4002 | 4069 | } |
| 4003 | 4070 | } else { |
| 4004 | 4071 | const zir_index = enum_value - Ref.typed_value_map.len; |
| 4005 | | return self.walkInstruction(file, parent_scope, zir_index, need_type); |
| 4072 | return self.walkInstruction(file, parent_scope, parent_line, zir_index, need_type); |
| 4006 | 4073 | } |
| 4007 | 4074 | } |
| 4008 | 4075 | |