| ... | ... | @@ -328,7 +328,14 @@ pub fn generateZirData(self: *Autodoc) !void { |
| 328 | 328 | }); |
| 329 | 329 | try self.files.put(self.arena, file, main_type_index); |
| 330 | 330 | |
| 331 | | _ = try self.walkInstruction(file, &root_scope, .{}, Zir.main_struct_inst, false); |
| 331 | _ = try self.walkInstruction( |
| 332 | file, |
| 333 | &root_scope, |
| 334 | .{}, |
| 335 | Zir.main_struct_inst, |
| 336 | false, |
| 337 | null, |
| 338 | ); |
| 332 | 339 | |
| 333 | 340 | if (self.ref_paths_pending_on_decls.count() > 0) { |
| 334 | 341 | @panic("some decl paths were never fully analized (pending on decls)"); |
| ... | ... | @@ -979,6 +986,15 @@ const AutodocErrors = error{ |
| 979 | 986 | UnexpectedEndOfFile, |
| 980 | 987 | } || std.fs.File.OpenError || std.fs.File.ReadError; |
| 981 | 988 | |
| 989 | /// `call` instructions will have loopy references to themselves |
| 990 | /// whenever an as_node is required for a complex expression. |
| 991 | /// This type is used to keep track of dangerous instruction |
| 992 | /// numbers that we definitely don't want to recurse into. |
| 993 | const CallContext = struct { |
| 994 | inst: usize, |
| 995 | prev: ?*const CallContext, |
| 996 | }; |
| 997 | |
| 982 | 998 | /// Called when we need to analyze a Zir instruction. |
| 983 | 999 | /// For example it gets called by `generateZirData` on instruction 0, |
| 984 | 1000 | /// which represents the top-level struct corresponding to the root file. |
| ... | ... | @@ -994,6 +1010,7 @@ fn walkInstruction( |
| 994 | 1010 | parent_src: SrcLocInfo, |
| 995 | 1011 | inst_index: usize, |
| 996 | 1012 | need_type: bool, // true if the caller needs us to provide also a typeRef |
| 1013 | call_ctx: ?*const CallContext, |
| 997 | 1014 | ) AutodocErrors!DocData.WalkResult { |
| 998 | 1015 | const tags = file.zir.instructions.items(.tag); |
| 999 | 1016 | const data = file.zir.instructions.items(.data); |
| ... | ... | @@ -1082,6 +1099,7 @@ fn walkInstruction( |
| 1082 | 1099 | .{}, |
| 1083 | 1100 | Zir.main_struct_inst, |
| 1084 | 1101 | false, |
| 1102 | call_ctx, |
| 1085 | 1103 | ); |
| 1086 | 1104 | } |
| 1087 | 1105 | |
| ... | ... | @@ -1113,6 +1131,7 @@ fn walkInstruction( |
| 1113 | 1131 | .{}, |
| 1114 | 1132 | Zir.main_struct_inst, |
| 1115 | 1133 | need_type, |
| 1134 | call_ctx, |
| 1116 | 1135 | ); |
| 1117 | 1136 | }, |
| 1118 | 1137 | .ret_type => { |
| ... | ... | @@ -1123,7 +1142,14 @@ fn walkInstruction( |
| 1123 | 1142 | }, |
| 1124 | 1143 | .ret_node => { |
| 1125 | 1144 | const un_node = data[inst_index].un_node; |
| 1126 | | return self.walkRef(file, parent_scope, parent_src, un_node.operand, false); |
| 1145 | return self.walkRef( |
| 1146 | file, |
| 1147 | parent_scope, |
| 1148 | parent_src, |
| 1149 | un_node.operand, |
| 1150 | false, |
| 1151 | call_ctx, |
| 1152 | ); |
| 1127 | 1153 | }, |
| 1128 | 1154 | .ret_load => { |
| 1129 | 1155 | const un_node = data[inst_index].un_node; |
| ... | ... | @@ -1154,7 +1180,14 @@ fn walkInstruction( |
| 1154 | 1180 | } |
| 1155 | 1181 | |
| 1156 | 1182 | if (result_ref) |rr| { |
| 1157 | | return self.walkRef(file, parent_scope, parent_src, rr, need_type); |
| 1183 | return self.walkRef( |
| 1184 | file, |
| 1185 | parent_scope, |
| 1186 | parent_src, |
| 1187 | rr, |
| 1188 | need_type, |
| 1189 | call_ctx, |
| 1190 | ); |
| 1158 | 1191 | } |
| 1159 | 1192 | |
| 1160 | 1193 | return DocData.WalkResult{ |
| ... | ... | @@ -1163,11 +1196,25 @@ fn walkInstruction( |
| 1163 | 1196 | }, |
| 1164 | 1197 | .closure_get => { |
| 1165 | 1198 | const inst_node = data[inst_index].inst_node; |
| 1166 | | return try self.walkInstruction(file, parent_scope, parent_src, inst_node.inst, need_type); |
| 1199 | return try self.walkInstruction( |
| 1200 | file, |
| 1201 | parent_scope, |
| 1202 | parent_src, |
| 1203 | inst_node.inst, |
| 1204 | need_type, |
| 1205 | call_ctx, |
| 1206 | ); |
| 1167 | 1207 | }, |
| 1168 | 1208 | .closure_capture => { |
| 1169 | 1209 | const un_tok = data[inst_index].un_tok; |
| 1170 | | return try self.walkRef(file, parent_scope, parent_src, un_tok.operand, need_type); |
| 1210 | return try self.walkRef( |
| 1211 | file, |
| 1212 | parent_scope, |
| 1213 | parent_src, |
| 1214 | un_tok.operand, |
| 1215 | need_type, |
| 1216 | call_ctx, |
| 1217 | ); |
| 1171 | 1218 | }, |
| 1172 | 1219 | .str => { |
| 1173 | 1220 | const str = data[inst_index].str.get(file.zir); |
| ... | ... | @@ -1214,6 +1261,7 @@ fn walkInstruction( |
| 1214 | 1261 | parent_src, |
| 1215 | 1262 | un_node.operand, |
| 1216 | 1263 | false, |
| 1264 | call_ctx, |
| 1217 | 1265 | ); |
| 1218 | 1266 | |
| 1219 | 1267 | const operand_index = self.exprs.items.len; |
| ... | ... | @@ -1284,6 +1332,7 @@ fn walkInstruction( |
| 1284 | 1332 | parent_src, |
| 1285 | 1333 | extra.data.lhs, |
| 1286 | 1334 | false, |
| 1335 | call_ctx, |
| 1287 | 1336 | ); |
| 1288 | 1337 | var start: DocData.WalkResult = try self.walkRef( |
| 1289 | 1338 | file, |
| ... | ... | @@ -1291,6 +1340,7 @@ fn walkInstruction( |
| 1291 | 1340 | parent_src, |
| 1292 | 1341 | extra.data.start, |
| 1293 | 1342 | false, |
| 1343 | call_ctx, |
| 1294 | 1344 | ); |
| 1295 | 1345 | |
| 1296 | 1346 | const lhs_index = self.exprs.items.len; |
| ... | ... | @@ -1317,6 +1367,7 @@ fn walkInstruction( |
| 1317 | 1367 | parent_src, |
| 1318 | 1368 | extra.data.lhs, |
| 1319 | 1369 | false, |
| 1370 | call_ctx, |
| 1320 | 1371 | ); |
| 1321 | 1372 | var start: DocData.WalkResult = try self.walkRef( |
| 1322 | 1373 | file, |
| ... | ... | @@ -1324,6 +1375,7 @@ fn walkInstruction( |
| 1324 | 1375 | parent_src, |
| 1325 | 1376 | extra.data.start, |
| 1326 | 1377 | false, |
| 1378 | call_ctx, |
| 1327 | 1379 | ); |
| 1328 | 1380 | var end: DocData.WalkResult = try self.walkRef( |
| 1329 | 1381 | file, |
| ... | ... | @@ -1331,6 +1383,7 @@ fn walkInstruction( |
| 1331 | 1383 | parent_src, |
| 1332 | 1384 | extra.data.end, |
| 1333 | 1385 | false, |
| 1386 | call_ctx, |
| 1334 | 1387 | ); |
| 1335 | 1388 | |
| 1336 | 1389 | const lhs_index = self.exprs.items.len; |
| ... | ... | @@ -1359,6 +1412,7 @@ fn walkInstruction( |
| 1359 | 1412 | parent_src, |
| 1360 | 1413 | extra.data.lhs, |
| 1361 | 1414 | false, |
| 1415 | call_ctx, |
| 1362 | 1416 | ); |
| 1363 | 1417 | var start: DocData.WalkResult = try self.walkRef( |
| 1364 | 1418 | file, |
| ... | ... | @@ -1366,6 +1420,7 @@ fn walkInstruction( |
| 1366 | 1420 | parent_src, |
| 1367 | 1421 | extra.data.start, |
| 1368 | 1422 | false, |
| 1423 | call_ctx, |
| 1369 | 1424 | ); |
| 1370 | 1425 | var end: DocData.WalkResult = try self.walkRef( |
| 1371 | 1426 | file, |
| ... | ... | @@ -1373,6 +1428,7 @@ fn walkInstruction( |
| 1373 | 1428 | parent_src, |
| 1374 | 1429 | extra.data.end, |
| 1375 | 1430 | false, |
| 1431 | call_ctx, |
| 1376 | 1432 | ); |
| 1377 | 1433 | var sentinel: DocData.WalkResult = try self.walkRef( |
| 1378 | 1434 | file, |
| ... | ... | @@ -1380,6 +1436,7 @@ fn walkInstruction( |
| 1380 | 1436 | parent_src, |
| 1381 | 1437 | extra.data.sentinel, |
| 1382 | 1438 | false, |
| 1439 | call_ctx, |
| 1383 | 1440 | ); |
| 1384 | 1441 | |
| 1385 | 1442 | const lhs_index = self.exprs.items.len; |
| ... | ... | @@ -1410,6 +1467,7 @@ fn walkInstruction( |
| 1410 | 1467 | parent_src, |
| 1411 | 1468 | extra.data.lhs, |
| 1412 | 1469 | false, |
| 1470 | call_ctx, |
| 1413 | 1471 | ); |
| 1414 | 1472 | var start: DocData.WalkResult = try self.walkRef( |
| 1415 | 1473 | file, |
| ... | ... | @@ -1417,6 +1475,7 @@ fn walkInstruction( |
| 1417 | 1475 | parent_src, |
| 1418 | 1476 | extra.data.start, |
| 1419 | 1477 | false, |
| 1478 | call_ctx, |
| 1420 | 1479 | ); |
| 1421 | 1480 | var len: DocData.WalkResult = try self.walkRef( |
| 1422 | 1481 | file, |
| ... | ... | @@ -1424,6 +1483,7 @@ fn walkInstruction( |
| 1424 | 1483 | parent_src, |
| 1425 | 1484 | extra.data.len, |
| 1426 | 1485 | false, |
| 1486 | call_ctx, |
| 1427 | 1487 | ); |
| 1428 | 1488 | var sentinel_opt: ?DocData.WalkResult = if (extra.data.sentinel != .none) |
| 1429 | 1489 | try self.walkRef( |
| ... | ... | @@ -1432,6 +1492,7 @@ fn walkInstruction( |
| 1432 | 1492 | parent_src, |
| 1433 | 1493 | extra.data.sentinel, |
| 1434 | 1494 | false, |
| 1495 | call_ctx, |
| 1435 | 1496 | ) |
| 1436 | 1497 | else |
| 1437 | 1498 | null; |
| ... | ... | @@ -1492,6 +1553,7 @@ fn walkInstruction( |
| 1492 | 1553 | parent_src, |
| 1493 | 1554 | extra.data.lhs, |
| 1494 | 1555 | false, |
| 1556 | call_ctx, |
| 1495 | 1557 | ); |
| 1496 | 1558 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1497 | 1559 | file, |
| ... | ... | @@ -1499,6 +1561,7 @@ fn walkInstruction( |
| 1499 | 1561 | parent_src, |
| 1500 | 1562 | extra.data.rhs, |
| 1501 | 1563 | false, |
| 1564 | call_ctx, |
| 1502 | 1565 | ); |
| 1503 | 1566 | |
| 1504 | 1567 | const lhs_index = self.exprs.items.len; |
| ... | ... | @@ -1536,6 +1599,7 @@ fn walkInstruction( |
| 1536 | 1599 | parent_src, |
| 1537 | 1600 | extra.data.lhs, |
| 1538 | 1601 | false, |
| 1602 | call_ctx, |
| 1539 | 1603 | ); |
| 1540 | 1604 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1541 | 1605 | file, |
| ... | ... | @@ -1543,6 +1607,7 @@ fn walkInstruction( |
| 1543 | 1607 | parent_src, |
| 1544 | 1608 | extra.data.rhs, |
| 1545 | 1609 | false, |
| 1610 | call_ctx, |
| 1546 | 1611 | ); |
| 1547 | 1612 | |
| 1548 | 1613 | const lhs_index = self.exprs.items.len; |
| ... | ... | @@ -1599,7 +1664,14 @@ fn walkInstruction( |
| 1599 | 1664 | const un_node = data[inst_index].un_node; |
| 1600 | 1665 | const bin_index = self.exprs.items.len; |
| 1601 | 1666 | try self.exprs.append(self.arena, .{ .builtin = .{ .param = 0 } }); |
| 1602 | | const param = try self.walkRef(file, parent_scope, parent_src, un_node.operand, false); |
| 1667 | const param = try self.walkRef( |
| 1668 | file, |
| 1669 | parent_scope, |
| 1670 | parent_src, |
| 1671 | un_node.operand, |
| 1672 | false, |
| 1673 | call_ctx, |
| 1674 | ); |
| 1603 | 1675 | |
| 1604 | 1676 | const param_index = self.exprs.items.len; |
| 1605 | 1677 | try self.exprs.append(self.arena, param.expr); |
| ... | ... | @@ -1623,6 +1695,7 @@ fn walkInstruction( |
| 1623 | 1695 | parent_src, |
| 1624 | 1696 | bool_br.lhs, |
| 1625 | 1697 | false, |
| 1698 | call_ctx, |
| 1626 | 1699 | ); |
| 1627 | 1700 | const lhs_index = self.exprs.items.len; |
| 1628 | 1701 | try self.exprs.append(self.arena, lhs.expr); |
| ... | ... | @@ -1634,6 +1707,7 @@ fn walkInstruction( |
| 1634 | 1707 | parent_src, |
| 1635 | 1708 | file.zir.extra[extra.end..][extra.data.body_len - 1], |
| 1636 | 1709 | false, |
| 1710 | call_ctx, |
| 1637 | 1711 | ); |
| 1638 | 1712 | const rhs_index = self.exprs.items.len; |
| 1639 | 1713 | try self.exprs.append(self.arena, rhs.expr); |
| ... | ... | @@ -1656,6 +1730,7 @@ fn walkInstruction( |
| 1656 | 1730 | parent_src, |
| 1657 | 1731 | extra.data.rhs, |
| 1658 | 1732 | false, |
| 1733 | call_ctx, |
| 1659 | 1734 | ); |
| 1660 | 1735 | |
| 1661 | 1736 | const bin_index = self.exprs.items.len; |
| ... | ... | @@ -1670,6 +1745,7 @@ fn walkInstruction( |
| 1670 | 1745 | parent_src, |
| 1671 | 1746 | extra.data.lhs, |
| 1672 | 1747 | false, |
| 1748 | call_ctx, |
| 1673 | 1749 | ); |
| 1674 | 1750 | |
| 1675 | 1751 | self.exprs.items[bin_index] = .{ .builtin = .{ .name = @tagName(tags[inst_index]), .param = rhs_index } }; |
| ... | ... | @@ -1718,6 +1794,7 @@ fn walkInstruction( |
| 1718 | 1794 | parent_src, |
| 1719 | 1795 | extra.data.lhs, |
| 1720 | 1796 | false, |
| 1797 | call_ctx, |
| 1721 | 1798 | ); |
| 1722 | 1799 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1723 | 1800 | file, |
| ... | ... | @@ -1725,6 +1802,7 @@ fn walkInstruction( |
| 1725 | 1802 | parent_src, |
| 1726 | 1803 | extra.data.rhs, |
| 1727 | 1804 | false, |
| 1805 | call_ctx, |
| 1728 | 1806 | ); |
| 1729 | 1807 | |
| 1730 | 1808 | const lhs_index = self.exprs.items.len; |
| ... | ... | @@ -1748,6 +1826,7 @@ fn walkInstruction( |
| 1748 | 1826 | parent_src, |
| 1749 | 1827 | extra.data.lhs, |
| 1750 | 1828 | false, |
| 1829 | call_ctx, |
| 1751 | 1830 | ); |
| 1752 | 1831 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1753 | 1832 | file, |
| ... | ... | @@ -1755,6 +1834,7 @@ fn walkInstruction( |
| 1755 | 1834 | parent_src, |
| 1756 | 1835 | extra.data.rhs, |
| 1757 | 1836 | false, |
| 1837 | call_ctx, |
| 1758 | 1838 | ); |
| 1759 | 1839 | |
| 1760 | 1840 | const type_slot_index = self.types.items.len; |
| ... | ... | @@ -1778,6 +1858,7 @@ fn walkInstruction( |
| 1778 | 1858 | parent_src, |
| 1779 | 1859 | extra.data.lhs, |
| 1780 | 1860 | false, |
| 1861 | call_ctx, |
| 1781 | 1862 | ); |
| 1782 | 1863 | var rhs: DocData.WalkResult = try self.walkRef( |
| 1783 | 1864 | file, |
| ... | ... | @@ -1785,6 +1866,7 @@ fn walkInstruction( |
| 1785 | 1866 | parent_src, |
| 1786 | 1867 | extra.data.rhs, |
| 1787 | 1868 | false, |
| 1869 | call_ctx, |
| 1788 | 1870 | ); |
| 1789 | 1871 | const type_slot_index = self.types.items.len; |
| 1790 | 1872 | try self.types.append(self.arena, .{ .ErrorUnion = .{ |
| ... | ... | @@ -1820,6 +1902,7 @@ fn walkInstruction( |
| 1820 | 1902 | parent_src, |
| 1821 | 1903 | extra.data.elem_type, |
| 1822 | 1904 | false, |
| 1905 | call_ctx, |
| 1823 | 1906 | ); |
| 1824 | 1907 | |
| 1825 | 1908 | // @check if `addrspace`, `bit_start` and `host_size` really need to be |
| ... | ... | @@ -1827,7 +1910,14 @@ fn walkInstruction( |
| 1827 | 1910 | var sentinel: ?DocData.Expr = null; |
| 1828 | 1911 | if (ptr.flags.has_sentinel) { |
| 1829 | 1912 | const ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 1830 | | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1913 | const ref_result = try self.walkRef( |
| 1914 | file, |
| 1915 | parent_scope, |
| 1916 | parent_src, |
| 1917 | ref, |
| 1918 | false, |
| 1919 | call_ctx, |
| 1920 | ); |
| 1831 | 1921 | sentinel = ref_result.expr; |
| 1832 | 1922 | extra_index += 1; |
| 1833 | 1923 | } |
| ... | ... | @@ -1835,21 +1925,42 @@ fn walkInstruction( |
| 1835 | 1925 | var @"align": ?DocData.Expr = null; |
| 1836 | 1926 | if (ptr.flags.has_align) { |
| 1837 | 1927 | const ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 1838 | | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1928 | const ref_result = try self.walkRef( |
| 1929 | file, |
| 1930 | parent_scope, |
| 1931 | parent_src, |
| 1932 | ref, |
| 1933 | false, |
| 1934 | call_ctx, |
| 1935 | ); |
| 1839 | 1936 | @"align" = ref_result.expr; |
| 1840 | 1937 | extra_index += 1; |
| 1841 | 1938 | } |
| 1842 | 1939 | var address_space: ?DocData.Expr = null; |
| 1843 | 1940 | if (ptr.flags.has_addrspace) { |
| 1844 | 1941 | const ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 1845 | | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1942 | const ref_result = try self.walkRef( |
| 1943 | file, |
| 1944 | parent_scope, |
| 1945 | parent_src, |
| 1946 | ref, |
| 1947 | false, |
| 1948 | call_ctx, |
| 1949 | ); |
| 1846 | 1950 | address_space = ref_result.expr; |
| 1847 | 1951 | extra_index += 1; |
| 1848 | 1952 | } |
| 1849 | 1953 | var bit_start: ?DocData.Expr = null; |
| 1850 | 1954 | if (ptr.flags.has_bit_range) { |
| 1851 | 1955 | const ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 1852 | | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1956 | const ref_result = try self.walkRef( |
| 1957 | file, |
| 1958 | parent_scope, |
| 1959 | parent_src, |
| 1960 | ref, |
| 1961 | false, |
| 1962 | call_ctx, |
| 1963 | ); |
| 1853 | 1964 | address_space = ref_result.expr; |
| 1854 | 1965 | extra_index += 1; |
| 1855 | 1966 | } |
| ... | ... | @@ -1857,7 +1968,14 @@ fn walkInstruction( |
| 1857 | 1968 | var host_size: ?DocData.Expr = null; |
| 1858 | 1969 | if (ptr.flags.has_bit_range) { |
| 1859 | 1970 | const ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 1860 | | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1971 | const ref_result = try self.walkRef( |
| 1972 | file, |
| 1973 | parent_scope, |
| 1974 | parent_src, |
| 1975 | ref, |
| 1976 | false, |
| 1977 | call_ctx, |
| 1978 | ); |
| 1861 | 1979 | host_size = ref_result.expr; |
| 1862 | 1980 | } |
| 1863 | 1981 | |
| ... | ... | @@ -1888,8 +2006,22 @@ fn walkInstruction( |
| 1888 | 2006 | const pl_node = data[inst_index].pl_node; |
| 1889 | 2007 | |
| 1890 | 2008 | const bin = file.zir.extraData(Zir.Inst.Bin, pl_node.payload_index).data; |
| 1891 | | const len = try self.walkRef(file, parent_scope, parent_src, bin.lhs, false); |
| 1892 | | const child = try self.walkRef(file, parent_scope, parent_src, bin.rhs, false); |
| 2009 | const len = try self.walkRef( |
| 2010 | file, |
| 2011 | parent_scope, |
| 2012 | parent_src, |
| 2013 | bin.lhs, |
| 2014 | false, |
| 2015 | call_ctx, |
| 2016 | ); |
| 2017 | const child = try self.walkRef( |
| 2018 | file, |
| 2019 | parent_scope, |
| 2020 | parent_src, |
| 2021 | bin.rhs, |
| 2022 | false, |
| 2023 | call_ctx, |
| 2024 | ); |
| 1893 | 2025 | |
| 1894 | 2026 | const type_slot_index = self.types.items.len; |
| 1895 | 2027 | try self.types.append(self.arena, .{ |
| ... | ... | @@ -1907,9 +2039,30 @@ fn walkInstruction( |
| 1907 | 2039 | .array_type_sentinel => { |
| 1908 | 2040 | const pl_node = data[inst_index].pl_node; |
| 1909 | 2041 | const extra = file.zir.extraData(Zir.Inst.ArrayTypeSentinel, pl_node.payload_index); |
| 1910 | | const len = try self.walkRef(file, parent_scope, parent_src, extra.data.len, false); |
| 1911 | | const sentinel = try self.walkRef(file, parent_scope, parent_src, extra.data.sentinel, false); |
| 1912 | | const elem_type = try self.walkRef(file, parent_scope, parent_src, extra.data.elem_type, false); |
| 2042 | const len = try self.walkRef( |
| 2043 | file, |
| 2044 | parent_scope, |
| 2045 | parent_src, |
| 2046 | extra.data.len, |
| 2047 | false, |
| 2048 | call_ctx, |
| 2049 | ); |
| 2050 | const sentinel = try self.walkRef( |
| 2051 | file, |
| 2052 | parent_scope, |
| 2053 | parent_src, |
| 2054 | extra.data.sentinel, |
| 2055 | false, |
| 2056 | call_ctx, |
| 2057 | ); |
| 2058 | const elem_type = try self.walkRef( |
| 2059 | file, |
| 2060 | parent_scope, |
| 2061 | parent_src, |
| 2062 | extra.data.elem_type, |
| 2063 | false, |
| 2064 | call_ctx, |
| 2065 | ); |
| 1913 | 2066 | |
| 1914 | 2067 | const type_slot_index = self.types.items.len; |
| 1915 | 2068 | try self.types.append(self.arena, .{ |
| ... | ... | @@ -1931,10 +2084,24 @@ fn walkInstruction( |
| 1931 | 2084 | const array_data = try self.arena.alloc(usize, operands.len - 1); |
| 1932 | 2085 | |
| 1933 | 2086 | std.debug.assert(operands.len > 0); |
| 1934 | | var array_type = try self.walkRef(file, parent_scope, parent_src, operands[0], false); |
| 2087 | var array_type = try self.walkRef( |
| 2088 | file, |
| 2089 | parent_scope, |
| 2090 | parent_src, |
| 2091 | operands[0], |
| 2092 | false, |
| 2093 | call_ctx, |
| 2094 | ); |
| 1935 | 2095 | |
| 1936 | 2096 | for (operands[1..], 0..) |op, idx| { |
| 1937 | | const wr = try self.walkRef(file, parent_scope, parent_src, op, false); |
| 2097 | const wr = try self.walkRef( |
| 2098 | file, |
| 2099 | parent_scope, |
| 2100 | parent_src, |
| 2101 | op, |
| 2102 | false, |
| 2103 | call_ctx, |
| 2104 | ); |
| 1938 | 2105 | const expr_index = self.exprs.items.len; |
| 1939 | 2106 | try self.exprs.append(self.arena, wr.expr); |
| 1940 | 2107 | array_data[idx] = expr_index; |
| ... | ... | @@ -1952,7 +2119,14 @@ fn walkInstruction( |
| 1952 | 2119 | const array_data = try self.arena.alloc(usize, operands.len); |
| 1953 | 2120 | |
| 1954 | 2121 | for (operands, 0..) |op, idx| { |
| 1955 | | const wr = try self.walkRef(file, parent_scope, parent_src, op, false); |
| 2122 | const wr = try self.walkRef( |
| 2123 | file, |
| 2124 | parent_scope, |
| 2125 | parent_src, |
| 2126 | op, |
| 2127 | false, |
| 2128 | call_ctx, |
| 2129 | ); |
| 1956 | 2130 | const expr_index = self.exprs.items.len; |
| 1957 | 2131 | try self.exprs.append(self.arena, wr.expr); |
| 1958 | 2132 | array_data[idx] = expr_index; |
| ... | ... | @@ -1970,10 +2144,24 @@ fn walkInstruction( |
| 1970 | 2144 | const array_data = try self.arena.alloc(usize, operands.len - 1); |
| 1971 | 2145 | |
| 1972 | 2146 | std.debug.assert(operands.len > 0); |
| 1973 | | var array_type = try self.walkRef(file, parent_scope, parent_src, operands[0], false); |
| 2147 | var array_type = try self.walkRef( |
| 2148 | file, |
| 2149 | parent_scope, |
| 2150 | parent_src, |
| 2151 | operands[0], |
| 2152 | false, |
| 2153 | call_ctx, |
| 2154 | ); |
| 1974 | 2155 | |
| 1975 | 2156 | for (operands[1..], 0..) |op, idx| { |
| 1976 | | const wr = try self.walkRef(file, parent_scope, parent_src, op, false); |
| 2157 | const wr = try self.walkRef( |
| 2158 | file, |
| 2159 | parent_scope, |
| 2160 | parent_src, |
| 2161 | op, |
| 2162 | false, |
| 2163 | call_ctx, |
| 2164 | ); |
| 1977 | 2165 | const expr_index = self.exprs.items.len; |
| 1978 | 2166 | try self.exprs.append(self.arena, wr.expr); |
| 1979 | 2167 | array_data[idx] = expr_index; |
| ... | ... | @@ -2002,7 +2190,14 @@ fn walkInstruction( |
| 2002 | 2190 | const array_data = try self.arena.alloc(usize, operands.len); |
| 2003 | 2191 | |
| 2004 | 2192 | for (operands, 0..) |op, idx| { |
| 2005 | | const wr = try self.walkRef(file, parent_scope, parent_src, op, false); |
| 2193 | const wr = try self.walkRef( |
| 2194 | file, |
| 2195 | parent_scope, |
| 2196 | parent_src, |
| 2197 | op, |
| 2198 | false, |
| 2199 | call_ctx, |
| 2200 | ); |
| 2006 | 2201 | const expr_index = self.exprs.items.len; |
| 2007 | 2202 | try self.exprs.append(self.arena, wr.expr); |
| 2008 | 2203 | array_data[idx] = expr_index; |
| ... | ... | @@ -2041,6 +2236,7 @@ fn walkInstruction( |
| 2041 | 2236 | parent_src, |
| 2042 | 2237 | un_node.operand, |
| 2043 | 2238 | need_type, |
| 2239 | call_ctx, |
| 2044 | 2240 | ); |
| 2045 | 2241 | switch (operand.expr) { |
| 2046 | 2242 | .int => |*int| int.negated = true, |
| ... | ... | @@ -2065,6 +2261,7 @@ fn walkInstruction( |
| 2065 | 2261 | parent_src, |
| 2066 | 2262 | un_node.operand, |
| 2067 | 2263 | false, |
| 2264 | call_ctx, |
| 2068 | 2265 | ); |
| 2069 | 2266 | const operand_index = self.exprs.items.len; |
| 2070 | 2267 | try self.exprs.append(self.arena, operand.expr); |
| ... | ... | @@ -2083,6 +2280,7 @@ fn walkInstruction( |
| 2083 | 2280 | parent_src, |
| 2084 | 2281 | un_node.operand, |
| 2085 | 2282 | need_type, |
| 2283 | call_ctx, |
| 2086 | 2284 | ); |
| 2087 | 2285 | const operand_index = self.exprs.items.len; |
| 2088 | 2286 | try self.exprs.append(self.arena, operand.expr); |
| ... | ... | @@ -2101,6 +2299,7 @@ fn walkInstruction( |
| 2101 | 2299 | parent_src, |
| 2102 | 2300 | un_node.operand, |
| 2103 | 2301 | false, |
| 2302 | call_ctx, |
| 2104 | 2303 | ); |
| 2105 | 2304 | const operand_index = self.exprs.items.len; |
| 2106 | 2305 | try self.exprs.append(self.arena, operand.expr); |
| ... | ... | @@ -2115,7 +2314,14 @@ fn walkInstruction( |
| 2115 | 2314 | const pl_node = data[inst_index].pl_node; |
| 2116 | 2315 | const extra = file.zir.extraData(Zir.Inst.SwitchBlock, pl_node.payload_index); |
| 2117 | 2316 | |
| 2118 | | const switch_cond = try self.walkRef(file, parent_scope, parent_src, extra.data.operand, false); |
| 2317 | const switch_cond = try self.walkRef( |
| 2318 | file, |
| 2319 | parent_scope, |
| 2320 | parent_src, |
| 2321 | extra.data.operand, |
| 2322 | false, |
| 2323 | call_ctx, |
| 2324 | ); |
| 2119 | 2325 | const cond_index = self.exprs.items.len; |
| 2120 | 2326 | try self.exprs.append(self.arena, switch_cond.expr); |
| 2121 | 2327 | _ = cond_index; |
| ... | ... | @@ -2162,6 +2368,7 @@ fn walkInstruction( |
| 2162 | 2368 | parent_src, |
| 2163 | 2369 | un_node.operand, |
| 2164 | 2370 | need_type, |
| 2371 | call_ctx, |
| 2165 | 2372 | ); |
| 2166 | 2373 | const operand_index = self.exprs.items.len; |
| 2167 | 2374 | try self.exprs.append(self.arena, operand.expr); |
| ... | ... | @@ -2181,6 +2388,7 @@ fn walkInstruction( |
| 2181 | 2388 | parent_src, |
| 2182 | 2389 | data[body].@"break".operand, |
| 2183 | 2390 | false, |
| 2391 | call_ctx, |
| 2184 | 2392 | ); |
| 2185 | 2393 | |
| 2186 | 2394 | const operand_index = self.exprs.items.len; |
| ... | ... | @@ -2201,6 +2409,7 @@ fn walkInstruction( |
| 2201 | 2409 | parent_src, |
| 2202 | 2410 | un_node.operand, |
| 2203 | 2411 | need_type, |
| 2412 | call_ctx, |
| 2204 | 2413 | ); |
| 2205 | 2414 | |
| 2206 | 2415 | const operand_index = self.exprs.items.len; |
| ... | ... | @@ -2214,12 +2423,31 @@ fn walkInstruction( |
| 2214 | 2423 | .as_node, .as_shift_operand => { |
| 2215 | 2424 | const pl_node = data[inst_index].pl_node; |
| 2216 | 2425 | const extra = file.zir.extraData(Zir.Inst.As, pl_node.payload_index); |
| 2426 | |
| 2427 | // Skip the as_node if the destination type is a call instruction |
| 2428 | if (Zir.refToIndex(extra.data.dest_type)) |dti| { |
| 2429 | var maybe_cc = call_ctx; |
| 2430 | while (maybe_cc) |cc| : (maybe_cc = cc.prev) { |
| 2431 | if (cc.inst == dti) { |
| 2432 | return try self.walkRef( |
| 2433 | file, |
| 2434 | parent_scope, |
| 2435 | parent_src, |
| 2436 | extra.data.operand, |
| 2437 | false, |
| 2438 | call_ctx, |
| 2439 | ); |
| 2440 | } |
| 2441 | } |
| 2442 | } |
| 2443 | |
| 2217 | 2444 | const dest_type_walk = try self.walkRef( |
| 2218 | 2445 | file, |
| 2219 | 2446 | parent_scope, |
| 2220 | 2447 | parent_src, |
| 2221 | 2448 | extra.data.dest_type, |
| 2222 | 2449 | false, |
| 2450 | call_ctx, |
| 2223 | 2451 | ); |
| 2224 | 2452 | |
| 2225 | 2453 | const operand = try self.walkRef( |
| ... | ... | @@ -2228,6 +2456,7 @@ fn walkInstruction( |
| 2228 | 2456 | parent_src, |
| 2229 | 2457 | extra.data.operand, |
| 2230 | 2458 | false, |
| 2459 | call_ctx, |
| 2231 | 2460 | ); |
| 2232 | 2461 | |
| 2233 | 2462 | const operand_idx = self.exprs.items.len; |
| ... | ... | @@ -2257,6 +2486,7 @@ fn walkInstruction( |
| 2257 | 2486 | parent_src, |
| 2258 | 2487 | un_node.operand, |
| 2259 | 2488 | false, |
| 2489 | call_ctx, |
| 2260 | 2490 | ); |
| 2261 | 2491 | |
| 2262 | 2492 | const operand_idx = self.types.items.len; |
| ... | ... | @@ -2332,7 +2562,14 @@ fn walkInstruction( |
| 2332 | 2562 | } |
| 2333 | 2563 | } |
| 2334 | 2564 | |
| 2335 | | break :blk try self.walkRef(file, parent_scope, parent_src, lhs_ref, false); |
| 2565 | break :blk try self.walkRef( |
| 2566 | file, |
| 2567 | parent_scope, |
| 2568 | parent_src, |
| 2569 | lhs_ref, |
| 2570 | false, |
| 2571 | call_ctx, |
| 2572 | ); |
| 2336 | 2573 | }; |
| 2337 | 2574 | try path.append(self.arena, wr.expr); |
| 2338 | 2575 | |
| ... | ... | @@ -2400,6 +2637,7 @@ fn walkInstruction( |
| 2400 | 2637 | return res; |
| 2401 | 2638 | }, |
| 2402 | 2639 | need_type, |
| 2640 | call_ctx, |
| 2403 | 2641 | ); |
| 2404 | 2642 | }, |
| 2405 | 2643 | .break_inline => { |
| ... | ... | @@ -2410,6 +2648,7 @@ fn walkInstruction( |
| 2410 | 2648 | parent_src, |
| 2411 | 2649 | @"break".operand, |
| 2412 | 2650 | need_type, |
| 2651 | call_ctx, |
| 2413 | 2652 | ); |
| 2414 | 2653 | }, |
| 2415 | 2654 | .struct_init => { |
| ... | ... | @@ -2448,6 +2687,7 @@ fn walkInstruction( |
| 2448 | 2687 | field_src, |
| 2449 | 2688 | field_extra.data.container_type, |
| 2450 | 2689 | false, |
| 2690 | call_ctx, |
| 2451 | 2691 | ); |
| 2452 | 2692 | type_ref = wr.expr; |
| 2453 | 2693 | } |
| ... | ... | @@ -2459,6 +2699,7 @@ fn walkInstruction( |
| 2459 | 2699 | parent_src, |
| 2460 | 2700 | init_extra.data.init, |
| 2461 | 2701 | need_type, |
| 2702 | call_ctx, |
| 2462 | 2703 | ); |
| 2463 | 2704 | fv.* = .{ .name = field_name, .val = value }; |
| 2464 | 2705 | } |
| ... | ... | @@ -2477,6 +2718,7 @@ fn walkInstruction( |
| 2477 | 2718 | parent_src, |
| 2478 | 2719 | un_node.operand, |
| 2479 | 2720 | false, |
| 2721 | call_ctx, |
| 2480 | 2722 | ); |
| 2481 | 2723 | |
| 2482 | 2724 | return DocData.WalkResult{ |
| ... | ... | @@ -2503,6 +2745,7 @@ fn walkInstruction( |
| 2503 | 2745 | parent_src, |
| 2504 | 2746 | init_extra.data.init, |
| 2505 | 2747 | need_type, |
| 2748 | call_ctx, |
| 2506 | 2749 | ); |
| 2507 | 2750 | fv.* = .{ .name = field_name, .val = value }; |
| 2508 | 2751 | idx = init_extra.end; |
| ... | ... | @@ -2576,7 +2819,14 @@ fn walkInstruction( |
| 2576 | 2819 | const pl_node = data[inst_index].pl_node; |
| 2577 | 2820 | const extra = file.zir.extraData(Zir.Inst.Call, pl_node.payload_index); |
| 2578 | 2821 | |
| 2579 | | const callee = try self.walkRef(file, parent_scope, parent_src, extra.data.callee, need_type); |
| 2822 | const callee = try self.walkRef( |
| 2823 | file, |
| 2824 | parent_scope, |
| 2825 | parent_src, |
| 2826 | extra.data.callee, |
| 2827 | need_type, |
| 2828 | call_ctx, |
| 2829 | ); |
| 2580 | 2830 | |
| 2581 | 2831 | const args_len = extra.data.flags.args_len; |
| 2582 | 2832 | var args = try self.arena.alloc(DocData.Expr, args_len); |
| ... | ... | @@ -2591,7 +2841,17 @@ fn walkInstruction( |
| 2591 | 2841 | // to show discrepancies between the types of provided |
| 2592 | 2842 | // arguments and the types declared in the function |
| 2593 | 2843 | // signature for its parameters. |
| 2594 | | const wr = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 2844 | const wr = try self.walkRef( |
| 2845 | file, |
| 2846 | parent_scope, |
| 2847 | parent_src, |
| 2848 | ref, |
| 2849 | false, |
| 2850 | &.{ |
| 2851 | .inst = inst_index, |
| 2852 | .prev = call_ctx, |
| 2853 | }, |
| 2854 | ); |
| 2595 | 2855 | args[i] = wr.expr; |
| 2596 | 2856 | } |
| 2597 | 2857 | |
| ... | ... | @@ -2639,6 +2899,7 @@ fn walkInstruction( |
| 2639 | 2899 | self_ast_node_index, |
| 2640 | 2900 | type_slot_index, |
| 2641 | 2901 | tags[inst_index] == .func_inferred, |
| 2902 | call_ctx, |
| 2642 | 2903 | ); |
| 2643 | 2904 | |
| 2644 | 2905 | return result; |
| ... | ... | @@ -2654,6 +2915,7 @@ fn walkInstruction( |
| 2654 | 2915 | inst_index, |
| 2655 | 2916 | self_ast_node_index, |
| 2656 | 2917 | type_slot_index, |
| 2918 | call_ctx, |
| 2657 | 2919 | ); |
| 2658 | 2920 | |
| 2659 | 2921 | return result; |
| ... | ... | @@ -2678,7 +2940,14 @@ fn walkInstruction( |
| 2678 | 2940 | |
| 2679 | 2941 | var array_type: ?DocData.Expr = null; |
| 2680 | 2942 | for (args, 0..) |arg, idx| { |
| 2681 | | const wr = try self.walkRef(file, parent_scope, parent_src, arg, idx == 0); |
| 2943 | const wr = try self.walkRef( |
| 2944 | file, |
| 2945 | parent_scope, |
| 2946 | parent_src, |
| 2947 | arg, |
| 2948 | idx == 0, |
| 2949 | call_ctx, |
| 2950 | ); |
| 2682 | 2951 | if (idx == 0) { |
| 2683 | 2952 | array_type = wr.typeRef; |
| 2684 | 2953 | } |
| ... | ... | @@ -2740,6 +3009,7 @@ fn walkInstruction( |
| 2740 | 3009 | src_info, |
| 2741 | 3010 | &decl_indexes, |
| 2742 | 3011 | &priv_decl_indexes, |
| 3012 | call_ctx, |
| 2743 | 3013 | ); |
| 2744 | 3014 | |
| 2745 | 3015 | self.types.items[type_slot_index] = .{ |
| ... | ... | @@ -2778,7 +3048,14 @@ fn walkInstruction( |
| 2778 | 3048 | if (small.has_lib_name) extra_index += 1; |
| 2779 | 3049 | if (small.has_align) extra_index += 1; |
| 2780 | 3050 | |
| 2781 | | const var_type = try self.walkRef(file, parent_scope, parent_src, extra.data.var_type, need_type); |
| 3051 | const var_type = try self.walkRef( |
| 3052 | file, |
| 3053 | parent_scope, |
| 3054 | parent_src, |
| 3055 | extra.data.var_type, |
| 3056 | need_type, |
| 3057 | call_ctx, |
| 3058 | ); |
| 2782 | 3059 | |
| 2783 | 3060 | var value: DocData.WalkResult = .{ |
| 2784 | 3061 | .typeRef = var_type.expr, |
| ... | ... | @@ -2787,7 +3064,14 @@ fn walkInstruction( |
| 2787 | 3064 | |
| 2788 | 3065 | if (small.has_init) { |
| 2789 | 3066 | const var_init_ref = @as(Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 2790 | | const var_init = try self.walkRef(file, parent_scope, parent_src, var_init_ref, need_type); |
| 3067 | const var_init = try self.walkRef( |
| 3068 | file, |
| 3069 | parent_scope, |
| 3070 | parent_src, |
| 3071 | var_init_ref, |
| 3072 | need_type, |
| 3073 | call_ctx, |
| 3074 | ); |
| 2791 | 3075 | value.expr = var_init.expr; |
| 2792 | 3076 | value.typeRef = var_init.typeRef; |
| 2793 | 3077 | } |
| ... | ... | @@ -2853,6 +3137,7 @@ fn walkInstruction( |
| 2853 | 3137 | src_info, |
| 2854 | 3138 | &decl_indexes, |
| 2855 | 3139 | &priv_decl_indexes, |
| 3140 | call_ctx, |
| 2856 | 3141 | ); |
| 2857 | 3142 | |
| 2858 | 3143 | // Analyze the tag once all decls have been analyzed |
| ... | ... | @@ -2862,6 +3147,7 @@ fn walkInstruction( |
| 2862 | 3147 | parent_src, |
| 2863 | 3148 | tt_ref, |
| 2864 | 3149 | false, |
| 3150 | call_ctx, |
| 2865 | 3151 | )).expr else null; |
| 2866 | 3152 | |
| 2867 | 3153 | // Fields |
| ... | ... | @@ -2883,6 +3169,7 @@ fn walkInstruction( |
| 2883 | 3169 | &field_type_refs, |
| 2884 | 3170 | &field_name_indexes, |
| 2885 | 3171 | extra_index, |
| 3172 | call_ctx, |
| 2886 | 3173 | ); |
| 2887 | 3174 | |
| 2888 | 3175 | self.ast_nodes.items[self_ast_node_index].fields = field_name_indexes.items; |
| ... | ... | @@ -2948,7 +3235,14 @@ fn walkInstruction( |
| 2948 | 3235 | const tag_type = file.zir.extra[extra_index]; |
| 2949 | 3236 | extra_index += 1; |
| 2950 | 3237 | const tag_ref = @as(Ref, @enumFromInt(tag_type)); |
| 2951 | | const wr = try self.walkRef(file, parent_scope, parent_src, tag_ref, false); |
| 3238 | const wr = try self.walkRef( |
| 3239 | file, |
| 3240 | parent_scope, |
| 3241 | parent_src, |
| 3242 | tag_ref, |
| 3243 | false, |
| 3244 | call_ctx, |
| 3245 | ); |
| 2952 | 3246 | break :blk wr.expr; |
| 2953 | 3247 | } else null; |
| 2954 | 3248 | |
| ... | ... | @@ -2974,6 +3268,7 @@ fn walkInstruction( |
| 2974 | 3268 | src_info, |
| 2975 | 3269 | &decl_indexes, |
| 2976 | 3270 | &priv_decl_indexes, |
| 3271 | call_ctx, |
| 2977 | 3272 | ); |
| 2978 | 3273 | |
| 2979 | 3274 | // const body = file.zir.extra[extra_index..][0..body_len]; |
| ... | ... | @@ -3005,7 +3300,14 @@ fn walkInstruction( |
| 3005 | 3300 | const value_expr: ?DocData.Expr = if (has_value) blk: { |
| 3006 | 3301 | const value_ref = file.zir.extra[extra_index]; |
| 3007 | 3302 | extra_index += 1; |
| 3008 | | const value = try self.walkRef(file, &scope, src_info, @as(Ref, @enumFromInt(value_ref)), false); |
| 3303 | const value = try self.walkRef( |
| 3304 | file, |
| 3305 | &scope, |
| 3306 | src_info, |
| 3307 | @as(Ref, @enumFromInt(value_ref)), |
| 3308 | false, |
| 3309 | call_ctx, |
| 3310 | ); |
| 3009 | 3311 | break :blk value.expr; |
| 3010 | 3312 | } else null; |
| 3011 | 3313 | try field_values.append(self.arena, value_expr); |
| ... | ... | @@ -3095,14 +3397,28 @@ fn walkInstruction( |
| 3095 | 3397 | extra_index += 1; // backing_int_body_len |
| 3096 | 3398 | if (backing_int_body_len == 0) { |
| 3097 | 3399 | const backing_int_ref = @as(Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 3098 | | const backing_int_res = try self.walkRef(file, &scope, src_info, backing_int_ref, true); |
| 3400 | const backing_int_res = try self.walkRef( |
| 3401 | file, |
| 3402 | &scope, |
| 3403 | src_info, |
| 3404 | backing_int_ref, |
| 3405 | true, |
| 3406 | call_ctx, |
| 3407 | ); |
| 3099 | 3408 | backing_int = backing_int_res.expr; |
| 3100 | 3409 | extra_index += 1; // backing_int_ref |
| 3101 | 3410 | } else { |
| 3102 | 3411 | const backing_int_body = file.zir.extra[extra_index..][0..backing_int_body_len]; |
| 3103 | 3412 | const break_inst = backing_int_body[backing_int_body.len - 1]; |
| 3104 | 3413 | const operand = data[break_inst].@"break".operand; |
| 3105 | | const backing_int_res = try self.walkRef(file, &scope, src_info, operand, true); |
| 3414 | const backing_int_res = try self.walkRef( |
| 3415 | file, |
| 3416 | &scope, |
| 3417 | src_info, |
| 3418 | operand, |
| 3419 | true, |
| 3420 | call_ctx, |
| 3421 | ); |
| 3106 | 3422 | backing_int = backing_int_res.expr; |
| 3107 | 3423 | extra_index += backing_int_body_len; // backing_int_body_inst |
| 3108 | 3424 | } |
| ... | ... | @@ -3123,6 +3439,7 @@ fn walkInstruction( |
| 3123 | 3439 | src_info, |
| 3124 | 3440 | &decl_indexes, |
| 3125 | 3441 | &priv_decl_indexes, |
| 3442 | call_ctx, |
| 3126 | 3443 | ); |
| 3127 | 3444 | |
| 3128 | 3445 | var field_type_refs: std.ArrayListUnmanaged(DocData.Expr) = .{}; |
| ... | ... | @@ -3138,6 +3455,7 @@ fn walkInstruction( |
| 3138 | 3455 | &field_name_indexes, |
| 3139 | 3456 | extra_index, |
| 3140 | 3457 | small.is_tuple, |
| 3458 | call_ctx, |
| 3141 | 3459 | ); |
| 3142 | 3460 | |
| 3143 | 3461 | self.ast_nodes.items[self_ast_node_index].fields = field_name_indexes.items; |
| ... | ... | @@ -3194,7 +3512,14 @@ fn walkInstruction( |
| 3194 | 3512 | const extra = file.zir.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 3195 | 3513 | const bin_index = self.exprs.items.len; |
| 3196 | 3514 | try self.exprs.append(self.arena, .{ .builtin = .{ .param = 0 } }); |
| 3197 | | const param = try self.walkRef(file, parent_scope, parent_src, extra.operand, false); |
| 3515 | const param = try self.walkRef( |
| 3516 | file, |
| 3517 | parent_scope, |
| 3518 | parent_src, |
| 3519 | extra.operand, |
| 3520 | false, |
| 3521 | call_ctx, |
| 3522 | ); |
| 3198 | 3523 | |
| 3199 | 3524 | const param_index = self.exprs.items.len; |
| 3200 | 3525 | try self.exprs.append(self.arena, param.expr); |
| ... | ... | @@ -3213,7 +3538,14 @@ fn walkInstruction( |
| 3213 | 3538 | const extra = file.zir.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 3214 | 3539 | const bin_index = self.exprs.items.len; |
| 3215 | 3540 | try self.exprs.append(self.arena, .{ .builtin = .{ .param = 0 } }); |
| 3216 | | const param = try self.walkRef(file, parent_scope, parent_src, extra.operand, false); |
| 3541 | const param = try self.walkRef( |
| 3542 | file, |
| 3543 | parent_scope, |
| 3544 | parent_src, |
| 3545 | extra.operand, |
| 3546 | false, |
| 3547 | call_ctx, |
| 3548 | ); |
| 3217 | 3549 | |
| 3218 | 3550 | const param_index = self.exprs.items.len; |
| 3219 | 3551 | try self.exprs.append(self.arena, param.expr); |
| ... | ... | @@ -3241,6 +3573,7 @@ fn walkInstruction( |
| 3241 | 3573 | parent_src, |
| 3242 | 3574 | extra.ptr, |
| 3243 | 3575 | false, |
| 3576 | call_ctx, |
| 3244 | 3577 | ); |
| 3245 | 3578 | try self.exprs.append(self.arena, ptr.expr); |
| 3246 | 3579 | |
| ... | ... | @@ -3251,6 +3584,7 @@ fn walkInstruction( |
| 3251 | 3584 | parent_src, |
| 3252 | 3585 | extra.expected_value, |
| 3253 | 3586 | false, |
| 3587 | call_ctx, |
| 3254 | 3588 | ); |
| 3255 | 3589 | try self.exprs.append(self.arena, expected_value.expr); |
| 3256 | 3590 | |
| ... | ... | @@ -3261,6 +3595,7 @@ fn walkInstruction( |
| 3261 | 3595 | parent_src, |
| 3262 | 3596 | extra.new_value, |
| 3263 | 3597 | false, |
| 3598 | call_ctx, |
| 3264 | 3599 | ); |
| 3265 | 3600 | try self.exprs.append(self.arena, new_value.expr); |
| 3266 | 3601 | |
| ... | ... | @@ -3271,6 +3606,7 @@ fn walkInstruction( |
| 3271 | 3606 | parent_src, |
| 3272 | 3607 | extra.success_order, |
| 3273 | 3608 | false, |
| 3609 | call_ctx, |
| 3274 | 3610 | ); |
| 3275 | 3611 | try self.exprs.append(self.arena, success_order.expr); |
| 3276 | 3612 | |
| ... | ... | @@ -3281,6 +3617,7 @@ fn walkInstruction( |
| 3281 | 3617 | parent_src, |
| 3282 | 3618 | extra.failure_order, |
| 3283 | 3619 | false, |
| 3620 | call_ctx, |
| 3284 | 3621 | ); |
| 3285 | 3622 | try self.exprs.append(self.arena, failure_order.expr); |
| 3286 | 3623 | |
| ... | ... | @@ -3319,6 +3656,7 @@ fn analyzeAllDecls( |
| 3319 | 3656 | parent_src: SrcLocInfo, |
| 3320 | 3657 | decl_indexes: *std.ArrayListUnmanaged(usize), |
| 3321 | 3658 | priv_decl_indexes: *std.ArrayListUnmanaged(usize), |
| 3659 | call_ctx: ?*const CallContext, |
| 3322 | 3660 | ) AutodocErrors!usize { |
| 3323 | 3661 | const first_decl_indexes_slot = decl_indexes.items.len; |
| 3324 | 3662 | const original_it = file.zir.declIterator(@as(u32, @intCast(parent_inst_index))); |
| ... | ... | @@ -3358,6 +3696,7 @@ fn analyzeAllDecls( |
| 3358 | 3696 | decl_indexes, |
| 3359 | 3697 | priv_decl_indexes, |
| 3360 | 3698 | d, |
| 3699 | call_ctx, |
| 3361 | 3700 | ); |
| 3362 | 3701 | }, |
| 3363 | 3702 | } |
| ... | ... | @@ -3387,6 +3726,7 @@ fn analyzeAllDecls( |
| 3387 | 3726 | decl_indexes, |
| 3388 | 3727 | priv_decl_indexes, |
| 3389 | 3728 | d, |
| 3729 | call_ctx, |
| 3390 | 3730 | ); |
| 3391 | 3731 | } |
| 3392 | 3732 | |
| ... | ... | @@ -3420,6 +3760,7 @@ fn analyzeDecl( |
| 3420 | 3760 | decl_indexes: *std.ArrayListUnmanaged(usize), |
| 3421 | 3761 | priv_decl_indexes: *std.ArrayListUnmanaged(usize), |
| 3422 | 3762 | d: Zir.DeclIterator.Item, |
| 3763 | call_ctx: ?*const CallContext, |
| 3423 | 3764 | ) AutodocErrors!void { |
| 3424 | 3765 | const data = file.zir.instructions.items(.data); |
| 3425 | 3766 | const is_pub = @as(u1, @truncate(d.flags >> 0)) != 0; |
| ... | ... | @@ -3497,7 +3838,14 @@ fn analyzeDecl( |
| 3497 | 3838 | break :idx idx; |
| 3498 | 3839 | }; |
| 3499 | 3840 | |
| 3500 | | const walk_result = try self.walkInstruction(file, scope, decl_src, value_index, true); |
| 3841 | const walk_result = try self.walkInstruction( |
| 3842 | file, |
| 3843 | scope, |
| 3844 | decl_src, |
| 3845 | value_index, |
| 3846 | true, |
| 3847 | call_ctx, |
| 3848 | ); |
| 3501 | 3849 | |
| 3502 | 3850 | const kind: []const u8 = if (try self.declIsVar(file, value_pl_node.src_node, parent_src)) "var" else "const"; |
| 3503 | 3851 | |
| ... | ... | @@ -3545,6 +3893,7 @@ fn analyzeUsingnamespaceDecl( |
| 3545 | 3893 | decl_indexes: *std.ArrayListUnmanaged(usize), |
| 3546 | 3894 | priv_decl_indexes: *std.ArrayListUnmanaged(usize), |
| 3547 | 3895 | d: Zir.DeclIterator.Item, |
| 3896 | call_ctx: ?*const CallContext, |
| 3548 | 3897 | ) AutodocErrors!void { |
| 3549 | 3898 | const data = file.zir.instructions.items(.data); |
| 3550 | 3899 | |
| ... | ... | @@ -3574,7 +3923,14 @@ fn analyzeUsingnamespaceDecl( |
| 3574 | 3923 | break :idx idx; |
| 3575 | 3924 | }; |
| 3576 | 3925 | |
| 3577 | | const walk_result = try self.walkInstruction(file, scope, decl_src, value_index, true); |
| 3926 | const walk_result = try self.walkInstruction( |
| 3927 | file, |
| 3928 | scope, |
| 3929 | decl_src, |
| 3930 | value_index, |
| 3931 | true, |
| 3932 | call_ctx, |
| 3933 | ); |
| 3578 | 3934 | |
| 3579 | 3935 | const decl_slot_index = self.decls.items.len; |
| 3580 | 3936 | try self.decls.append(self.arena, .{ |
| ... | ... | @@ -4192,6 +4548,7 @@ fn analyzeFancyFunction( |
| 4192 | 4548 | inst_index: usize, |
| 4193 | 4549 | self_ast_node_index: usize, |
| 4194 | 4550 | type_slot_index: usize, |
| 4551 | call_ctx: ?*const CallContext, |
| 4195 | 4552 | ) AutodocErrors!DocData.WalkResult { |
| 4196 | 4553 | const tags = file.zir.instructions.items(.tag); |
| 4197 | 4554 | const data = file.zir.instructions.items(.data); |
| ... | ... | @@ -4253,7 +4610,14 @@ fn analyzeFancyFunction( |
| 4253 | 4610 | |
| 4254 | 4611 | const break_index = file.zir.extra[extra.end..][extra.data.body_len - 1]; |
| 4255 | 4612 | const break_operand = data[break_index].@"break".operand; |
| 4256 | | const param_type_ref = try self.walkRef(file, scope, parent_src, break_operand, false); |
| 4613 | const param_type_ref = try self.walkRef( |
| 4614 | file, |
| 4615 | scope, |
| 4616 | parent_src, |
| 4617 | break_operand, |
| 4618 | false, |
| 4619 | call_ctx, |
| 4620 | ); |
| 4257 | 4621 | |
| 4258 | 4622 | param_type_refs.appendAssumeCapacity(param_type_ref.expr); |
| 4259 | 4623 | }, |
| ... | ... | @@ -4277,7 +4641,14 @@ fn analyzeFancyFunction( |
| 4277 | 4641 | if (extra.data.bits.has_align_ref) { |
| 4278 | 4642 | const align_ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 4279 | 4643 | align_index = self.exprs.items.len; |
| 4280 | | _ = try self.walkRef(file, scope, parent_src, align_ref, false); |
| 4644 | _ = try self.walkRef( |
| 4645 | file, |
| 4646 | scope, |
| 4647 | parent_src, |
| 4648 | align_ref, |
| 4649 | false, |
| 4650 | call_ctx, |
| 4651 | ); |
| 4281 | 4652 | extra_index += 1; |
| 4282 | 4653 | } else if (extra.data.bits.has_align_body) { |
| 4283 | 4654 | const align_body_len = file.zir.extra[extra_index]; |
| ... | ... | @@ -4294,7 +4665,14 @@ fn analyzeFancyFunction( |
| 4294 | 4665 | if (extra.data.bits.has_addrspace_ref) { |
| 4295 | 4666 | const addrspace_ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 4296 | 4667 | addrspace_index = self.exprs.items.len; |
| 4297 | | _ = try self.walkRef(file, scope, parent_src, addrspace_ref, false); |
| 4668 | _ = try self.walkRef( |
| 4669 | file, |
| 4670 | scope, |
| 4671 | parent_src, |
| 4672 | addrspace_ref, |
| 4673 | false, |
| 4674 | call_ctx, |
| 4675 | ); |
| 4298 | 4676 | extra_index += 1; |
| 4299 | 4677 | } else if (extra.data.bits.has_addrspace_body) { |
| 4300 | 4678 | const addrspace_body_len = file.zir.extra[extra_index]; |
| ... | ... | @@ -4311,7 +4689,14 @@ fn analyzeFancyFunction( |
| 4311 | 4689 | if (extra.data.bits.has_section_ref) { |
| 4312 | 4690 | const section_ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 4313 | 4691 | section_index = self.exprs.items.len; |
| 4314 | | _ = try self.walkRef(file, scope, parent_src, section_ref, false); |
| 4692 | _ = try self.walkRef( |
| 4693 | file, |
| 4694 | scope, |
| 4695 | parent_src, |
| 4696 | section_ref, |
| 4697 | false, |
| 4698 | call_ctx, |
| 4699 | ); |
| 4315 | 4700 | extra_index += 1; |
| 4316 | 4701 | } else if (extra.data.bits.has_section_body) { |
| 4317 | 4702 | const section_body_len = file.zir.extra[extra_index]; |
| ... | ... | @@ -4327,7 +4712,14 @@ fn analyzeFancyFunction( |
| 4327 | 4712 | var cc_index: ?usize = null; |
| 4328 | 4713 | if (extra.data.bits.has_cc_ref and !extra.data.bits.has_cc_body) { |
| 4329 | 4714 | const cc_ref = @as(Zir.Inst.Ref, @enumFromInt(file.zir.extra[extra_index])); |
| 4330 | | const cc_expr = try self.walkRef(file, scope, parent_src, cc_ref, false); |
| 4715 | const cc_expr = try self.walkRef( |
| 4716 | file, |
| 4717 | scope, |
| 4718 | parent_src, |
| 4719 | cc_ref, |
| 4720 | false, |
| 4721 | call_ctx, |
| 4722 | ); |
| 4331 | 4723 | |
| 4332 | 4724 | cc_index = self.exprs.items.len; |
| 4333 | 4725 | try self.exprs.append(self.arena, cc_expr.expr); |
| ... | ... | @@ -4341,7 +4733,14 @@ fn analyzeFancyFunction( |
| 4341 | 4733 | // We assume the body ends with a break_inline |
| 4342 | 4734 | const break_index = cc_body[cc_body.len - 1]; |
| 4343 | 4735 | const break_operand = data[break_index].@"break".operand; |
| 4344 | | const cc_expr = try self.walkRef(file, scope, parent_src, break_operand, false); |
| 4736 | const cc_expr = try self.walkRef( |
| 4737 | file, |
| 4738 | scope, |
| 4739 | parent_src, |
| 4740 | break_operand, |
| 4741 | false, |
| 4742 | call_ctx, |
| 4743 | ); |
| 4345 | 4744 | |
| 4346 | 4745 | cc_index = self.exprs.items.len; |
| 4347 | 4746 | try self.exprs.append(self.arena, cc_expr.expr); |
| ... | ... | @@ -4357,14 +4756,28 @@ fn analyzeFancyFunction( |
| 4357 | 4756 | .none => DocData.Expr{ .void = .{} }, |
| 4358 | 4757 | else => blk: { |
| 4359 | 4758 | const ref = fn_info.ret_ty_ref; |
| 4360 | | const wr = try self.walkRef(file, scope, parent_src, ref, false); |
| 4759 | const wr = try self.walkRef( |
| 4760 | file, |
| 4761 | scope, |
| 4762 | parent_src, |
| 4763 | ref, |
| 4764 | false, |
| 4765 | call_ctx, |
| 4766 | ); |
| 4361 | 4767 | break :blk wr.expr; |
| 4362 | 4768 | }, |
| 4363 | 4769 | }, |
| 4364 | 4770 | else => blk: { |
| 4365 | 4771 | const last_instr_index = fn_info.ret_ty_body[fn_info.ret_ty_body.len - 1]; |
| 4366 | 4772 | const break_operand = data[last_instr_index].@"break".operand; |
| 4367 | | const wr = try self.walkRef(file, scope, parent_src, break_operand, false); |
| 4773 | const wr = try self.walkRef( |
| 4774 | file, |
| 4775 | scope, |
| 4776 | parent_src, |
| 4777 | break_operand, |
| 4778 | false, |
| 4779 | call_ctx, |
| 4780 | ); |
| 4368 | 4781 | break :blk wr.expr; |
| 4369 | 4782 | }, |
| 4370 | 4783 | }; |
| ... | ... | @@ -4381,6 +4794,7 @@ fn analyzeFancyFunction( |
| 4381 | 4794 | scope, |
| 4382 | 4795 | parent_src, |
| 4383 | 4796 | fn_info.body[0], |
| 4797 | call_ctx, |
| 4384 | 4798 | ); |
| 4385 | 4799 | } else { |
| 4386 | 4800 | break :blk null; |
| ... | ... | @@ -4426,6 +4840,7 @@ fn analyzeFunction( |
| 4426 | 4840 | self_ast_node_index: usize, |
| 4427 | 4841 | type_slot_index: usize, |
| 4428 | 4842 | ret_is_inferred_error_set: bool, |
| 4843 | call_ctx: ?*const CallContext, |
| 4429 | 4844 | ) AutodocErrors!DocData.WalkResult { |
| 4430 | 4845 | const tags = file.zir.instructions.items(.tag); |
| 4431 | 4846 | const data = file.zir.instructions.items(.data); |
| ... | ... | @@ -4487,7 +4902,14 @@ fn analyzeFunction( |
| 4487 | 4902 | |
| 4488 | 4903 | const break_index = file.zir.extra[extra.end..][extra.data.body_len - 1]; |
| 4489 | 4904 | const break_operand = data[break_index].@"break".operand; |
| 4490 | | const param_type_ref = try self.walkRef(file, scope, parent_src, break_operand, false); |
| 4905 | const param_type_ref = try self.walkRef( |
| 4906 | file, |
| 4907 | scope, |
| 4908 | parent_src, |
| 4909 | break_operand, |
| 4910 | false, |
| 4911 | call_ctx, |
| 4912 | ); |
| 4491 | 4913 | |
| 4492 | 4914 | param_type_refs.appendAssumeCapacity(param_type_ref.expr); |
| 4493 | 4915 | }, |
| ... | ... | @@ -4500,14 +4922,28 @@ fn analyzeFunction( |
| 4500 | 4922 | .none => DocData.Expr{ .void = .{} }, |
| 4501 | 4923 | else => blk: { |
| 4502 | 4924 | const ref = fn_info.ret_ty_ref; |
| 4503 | | const wr = try self.walkRef(file, scope, parent_src, ref, false); |
| 4925 | const wr = try self.walkRef( |
| 4926 | file, |
| 4927 | scope, |
| 4928 | parent_src, |
| 4929 | ref, |
| 4930 | false, |
| 4931 | call_ctx, |
| 4932 | ); |
| 4504 | 4933 | break :blk wr.expr; |
| 4505 | 4934 | }, |
| 4506 | 4935 | }, |
| 4507 | 4936 | else => blk: { |
| 4508 | 4937 | const last_instr_index = fn_info.ret_ty_body[fn_info.ret_ty_body.len - 1]; |
| 4509 | 4938 | const break_operand = data[last_instr_index].@"break".operand; |
| 4510 | | const wr = try self.walkRef(file, scope, parent_src, break_operand, false); |
| 4939 | const wr = try self.walkRef( |
| 4940 | file, |
| 4941 | scope, |
| 4942 | parent_src, |
| 4943 | break_operand, |
| 4944 | false, |
| 4945 | call_ctx, |
| 4946 | ); |
| 4511 | 4947 | break :blk wr.expr; |
| 4512 | 4948 | }, |
| 4513 | 4949 | }; |
| ... | ... | @@ -4524,6 +4960,7 @@ fn analyzeFunction( |
| 4524 | 4960 | scope, |
| 4525 | 4961 | parent_src, |
| 4526 | 4962 | fn_info.body[0], |
| 4963 | call_ctx, |
| 4527 | 4964 | ); |
| 4528 | 4965 | } else { |
| 4529 | 4966 | break :blk null; |
| ... | ... | @@ -4570,6 +5007,7 @@ fn getGenericReturnType( |
| 4570 | 5007 | scope: *Scope, |
| 4571 | 5008 | parent_src: SrcLocInfo, // function decl line |
| 4572 | 5009 | body_main_block: usize, |
| 5010 | call_ctx: ?*const CallContext, |
| 4573 | 5011 | ) !DocData.Expr { |
| 4574 | 5012 | const tags = file.zir.instructions.items(.tag); |
| 4575 | 5013 | const data = file.zir.instructions.items(.data); |
| ... | ... | @@ -4581,7 +5019,14 @@ fn getGenericReturnType( |
| 4581 | 5019 | const maybe_ret_node = file.zir.extra[extra.end..][extra.data.body_len - 4]; |
| 4582 | 5020 | switch (tags[maybe_ret_node]) { |
| 4583 | 5021 | .ret_node, .ret_load => { |
| 4584 | | const wr = try self.walkInstruction(file, scope, parent_src, maybe_ret_node, false); |
| 5022 | const wr = try self.walkInstruction( |
| 5023 | file, |
| 5024 | scope, |
| 5025 | parent_src, |
| 5026 | maybe_ret_node, |
| 5027 | false, |
| 5028 | call_ctx, |
| 5029 | ); |
| 4585 | 5030 | return wr.expr; |
| 4586 | 5031 | }, |
| 4587 | 5032 | else => { |
| ... | ... | @@ -4599,6 +5044,7 @@ fn collectUnionFieldInfo( |
| 4599 | 5044 | field_type_refs: *std.ArrayListUnmanaged(DocData.Expr), |
| 4600 | 5045 | field_name_indexes: *std.ArrayListUnmanaged(usize), |
| 4601 | 5046 | ei: usize, |
| 5047 | call_ctx: ?*const CallContext, |
| 4602 | 5048 | ) !void { |
| 4603 | 5049 | if (fields_len == 0) return; |
| 4604 | 5050 | var extra_index = ei; |
| ... | ... | @@ -4641,7 +5087,14 @@ fn collectUnionFieldInfo( |
| 4641 | 5087 | |
| 4642 | 5088 | // type |
| 4643 | 5089 | { |
| 4644 | | const walk_result = try self.walkRef(file, scope, parent_src, field_type, false); |
| 5090 | const walk_result = try self.walkRef( |
| 5091 | file, |
| 5092 | scope, |
| 5093 | parent_src, |
| 5094 | field_type, |
| 5095 | false, |
| 5096 | call_ctx, |
| 5097 | ); |
| 4645 | 5098 | try field_type_refs.append(self.arena, walk_result.expr); |
| 4646 | 5099 | } |
| 4647 | 5100 | |
| ... | ... | @@ -4671,6 +5124,7 @@ fn collectStructFieldInfo( |
| 4671 | 5124 | field_name_indexes: *std.ArrayListUnmanaged(usize), |
| 4672 | 5125 | ei: usize, |
| 4673 | 5126 | is_tuple: bool, |
| 5127 | call_ctx: ?*const CallContext, |
| 4674 | 5128 | ) !void { |
| 4675 | 5129 | if (fields_len == 0) return; |
| 4676 | 5130 | var extra_index = ei; |
| ... | ... | @@ -4744,7 +5198,14 @@ fn collectStructFieldInfo( |
| 4744 | 5198 | for (fields) |field| { |
| 4745 | 5199 | const type_expr = expr: { |
| 4746 | 5200 | if (field.type_ref != .none) { |
| 4747 | | const walk_result = try self.walkRef(file, scope, parent_src, field.type_ref, false); |
| 5201 | const walk_result = try self.walkRef( |
| 5202 | file, |
| 5203 | scope, |
| 5204 | parent_src, |
| 5205 | field.type_ref, |
| 5206 | false, |
| 5207 | call_ctx, |
| 5208 | ); |
| 4748 | 5209 | break :expr walk_result.expr; |
| 4749 | 5210 | } |
| 4750 | 5211 | |
| ... | ... | @@ -4760,7 +5221,14 @@ fn collectStructFieldInfo( |
| 4760 | 5221 | .col = 0, |
| 4761 | 5222 | .fields = null, // walkInstruction will fill `fields` if necessary |
| 4762 | 5223 | }); |
| 4763 | | const walk_result = try self.walkRef(file, scope, parent_src, operand, false); |
| 5224 | const walk_result = try self.walkRef( |
| 5225 | file, |
| 5226 | scope, |
| 5227 | parent_src, |
| 5228 | operand, |
| 5229 | false, |
| 5230 | call_ctx, |
| 5231 | ); |
| 4764 | 5232 | break :expr walk_result.expr; |
| 4765 | 5233 | }; |
| 4766 | 5234 | |
| ... | ... | @@ -4776,7 +5244,14 @@ fn collectStructFieldInfo( |
| 4776 | 5244 | |
| 4777 | 5245 | const break_inst = body[body.len - 1]; |
| 4778 | 5246 | const operand = data[break_inst].@"break".operand; |
| 4779 | | const walk_result = try self.walkRef(file, scope, parent_src, operand, false); |
| 5247 | const walk_result = try self.walkRef( |
| 5248 | file, |
| 5249 | scope, |
| 5250 | parent_src, |
| 5251 | operand, |
| 5252 | false, |
| 5253 | call_ctx, |
| 5254 | ); |
| 4780 | 5255 | break :def walk_result.expr; |
| 4781 | 5256 | }; |
| 4782 | 5257 | |
| ... | ... | @@ -4812,6 +5287,7 @@ fn walkRef( |
| 4812 | 5287 | parent_src: SrcLocInfo, |
| 4813 | 5288 | ref: Ref, |
| 4814 | 5289 | need_type: bool, // true when the caller needs also a typeRef for the return value |
| 5290 | call_ctx: ?*const CallContext, |
| 4815 | 5291 | ) AutodocErrors!DocData.WalkResult { |
| 4816 | 5292 | if (ref == .none) { |
| 4817 | 5293 | return .{ .expr = .{ .comptimeExpr = 0 } }; |
| ... | ... | @@ -4824,7 +5300,14 @@ fn walkRef( |
| 4824 | 5300 | .expr = .{ .type = @intFromEnum(ref) }, |
| 4825 | 5301 | }; |
| 4826 | 5302 | } else if (Zir.refToIndex(ref)) |zir_index| { |
| 4827 | | return self.walkInstruction(file, parent_scope, parent_src, zir_index, need_type); |
| 5303 | return self.walkInstruction( |
| 5304 | file, |
| 5305 | parent_scope, |
| 5306 | parent_src, |
| 5307 | zir_index, |
| 5308 | need_type, |
| 5309 | call_ctx, |
| 5310 | ); |
| 4828 | 5311 | } else { |
| 4829 | 5312 | switch (ref) { |
| 4830 | 5313 | else => { |