| ... | @@ -401,7 +401,6 @@ pub const Node = struct { | ... | @@ -401,7 +401,6 @@ pub const Node = struct { |
| 401 | /// All the child Node types use this same Iterator state for their iteration. | 401 | /// All the child Node types use this same Iterator state for their iteration. |
| 402 | pub const Iterator = struct { | 402 | pub const Iterator = struct { |
| 403 | parent_node: *const Node, | 403 | parent_node: *const Node, |
| 404 | node: ?*LinkedList(*Node).Node, | | |
| 405 | index: usize, | 404 | index: usize, |
| 406 | | 405 | |
| 407 | pub fn next(it: *Iterator) ?*Node { | 406 | pub fn next(it: *Iterator) ?*Node { |
| ... | @@ -648,7 +647,7 @@ pub const Node = struct { | ... | @@ -648,7 +647,7 @@ pub const Node = struct { |
| 648 | } | 647 | } |
| 649 | | 648 | |
| 650 | pub fn iterate(self: *const Root) Node.Iterator { | 649 | pub fn iterate(self: *const Root) Node.Iterator { |
| 651 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 650 | return .{ .parent_node = &self.base, .index = 0 }; |
| 652 | } | 651 | } |
| 653 | | 652 | |
| 654 | pub fn iterateNext(self: *const Root, it: *Node.Iterator) ?*Node { | 653 | pub fn iterateNext(self: *const Root, it: *Node.Iterator) ?*Node { |
| ... | @@ -702,7 +701,7 @@ pub const Node = struct { | ... | @@ -702,7 +701,7 @@ pub const Node = struct { |
| 702 | semicolon_token: TokenIndex, | 701 | semicolon_token: TokenIndex, |
| 703 | | 702 | |
| 704 | pub fn iterate(self: *const VarDecl) Node.Iterator { | 703 | pub fn iterate(self: *const VarDecl) Node.Iterator { |
| 705 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 704 | return .{ .parent_node = &self.base, .index = 0 }; |
| 706 | } | 705 | } |
| 707 | | 706 | |
| 708 | pub fn iterateNext(self: *const VarDecl, it: *Node.Iterator) ?*Node { | 707 | pub fn iterateNext(self: *const VarDecl, it: *Node.Iterator) ?*Node { |
| ... | @@ -756,7 +755,7 @@ pub const Node = struct { | ... | @@ -756,7 +755,7 @@ pub const Node = struct { |
| 756 | semicolon_token: TokenIndex, | 755 | semicolon_token: TokenIndex, |
| 757 | | 756 | |
| 758 | pub fn iterate(self: *const Use) Node.Iterator { | 757 | pub fn iterate(self: *const Use) Node.Iterator { |
| 759 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 758 | return .{ .parent_node = &self.base, .index = 0 }; |
| 760 | } | 759 | } |
| 761 | | 760 | |
| 762 | pub fn iterateNext(self: *const Use, it: *Node.Iterator) ?*Node { | 761 | pub fn iterateNext(self: *const Use, it: *Node.Iterator) ?*Node { |
| ... | @@ -797,13 +796,17 @@ pub const Node = struct { | ... | @@ -797,13 +796,17 @@ pub const Node = struct { |
| 797 | } | 796 | } |
| 798 | | 797 | |
| 799 | pub fn iterate(self: *const ErrorSetDecl) Node.Iterator { | 798 | pub fn iterate(self: *const ErrorSetDecl) Node.Iterator { |
| 800 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 799 | return .{ .parent_node = &self.base, .index = 0 }; |
| 801 | } | 800 | } |
| 802 | | 801 | |
| 803 | pub fn iterateNext(self: *const ErrorSetDecl, it: *Node.Iterator) ?*Node { | 802 | pub fn iterateNext(self: *const ErrorSetDecl, it: *Node.Iterator) ?*Node { |
| 804 | const decl = it.node orelse return null; | 803 | var i = it.index; |
| 805 | it.node = decl.next; | 804 | it.index += 1; |
| 806 | return decl.data; | 805 | |
| | 806 | if (i < self.decls_len) return self.declsConst()[i]; |
| | 807 | i -= self.decls_len; |
| | 808 | |
| | 809 | return null; |
| 807 | } | 810 | } |
| 808 | | 811 | |
| 809 | pub fn firstToken(self: *const ErrorSetDecl) TokenIndex { | 812 | pub fn firstToken(self: *const ErrorSetDecl) TokenIndex { |
| ... | @@ -857,7 +860,7 @@ pub const Node = struct { | ... | @@ -857,7 +860,7 @@ pub const Node = struct { |
| 857 | } | 860 | } |
| 858 | | 861 | |
| 859 | pub fn iterate(self: *const ContainerDecl) Node.Iterator { | 862 | pub fn iterate(self: *const ContainerDecl) Node.Iterator { |
| 860 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 863 | return .{ .parent_node = &self.base, .index = 0 }; |
| 861 | } | 864 | } |
| 862 | | 865 | |
| 863 | pub fn iterateNext(self: *const ContainerDecl, it: *Node.Iterator) ?*Node { | 866 | pub fn iterateNext(self: *const ContainerDecl, it: *Node.Iterator) ?*Node { |
| ... | @@ -914,7 +917,7 @@ pub const Node = struct { | ... | @@ -914,7 +917,7 @@ pub const Node = struct { |
| 914 | align_expr: ?*Node, | 917 | align_expr: ?*Node, |
| 915 | | 918 | |
| 916 | pub fn iterate(self: *const ContainerField) Node.Iterator { | 919 | pub fn iterate(self: *const ContainerField) Node.Iterator { |
| 917 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 920 | return .{ .parent_node = &self.base, .index = 0 }; |
| 918 | } | 921 | } |
| 919 | | 922 | |
| 920 | pub fn iterateNext(self: *const ContainerField, it: *Node.Iterator) ?*Node { | 923 | pub fn iterateNext(self: *const ContainerField, it: *Node.Iterator) ?*Node { |
| ... | @@ -966,7 +969,7 @@ pub const Node = struct { | ... | @@ -966,7 +969,7 @@ pub const Node = struct { |
| 966 | name_token: TokenIndex, | 969 | name_token: TokenIndex, |
| 967 | | 970 | |
| 968 | pub fn iterate(self: *const ErrorTag) Node.Iterator { | 971 | pub fn iterate(self: *const ErrorTag) Node.Iterator { |
| 969 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 972 | return .{ .parent_node = &self.base, .index = 0 }; |
| 970 | } | 973 | } |
| 971 | | 974 | |
| 972 | pub fn iterateNext(self: *const ErrorTag, it: *Node.Iterator) ?*Node { | 975 | pub fn iterateNext(self: *const ErrorTag, it: *Node.Iterator) ?*Node { |
| ... | @@ -995,7 +998,7 @@ pub const Node = struct { | ... | @@ -995,7 +998,7 @@ pub const Node = struct { |
| 995 | token: TokenIndex, | 998 | token: TokenIndex, |
| 996 | | 999 | |
| 997 | pub fn iterate(self: *const Identifier) Node.Iterator { | 1000 | pub fn iterate(self: *const Identifier) Node.Iterator { |
| 998 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1001 | return .{ .parent_node = &self.base, .index = 0 }; |
| 999 | } | 1002 | } |
| 1000 | | 1003 | |
| 1001 | pub fn iterateNext(self: *const Identifier, it: *Node.Iterator) ?*Node { | 1004 | pub fn iterateNext(self: *const Identifier, it: *Node.Iterator) ?*Node { |
| ... | @@ -1050,7 +1053,7 @@ pub const Node = struct { | ... | @@ -1050,7 +1053,7 @@ pub const Node = struct { |
| 1050 | }; | 1053 | }; |
| 1051 | | 1054 | |
| 1052 | pub fn iterate(self: *const ParamDecl) Node.Iterator { | 1055 | pub fn iterate(self: *const ParamDecl) Node.Iterator { |
| 1053 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1056 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1054 | } | 1057 | } |
| 1055 | | 1058 | |
| 1056 | pub fn iterateNext(self: *const ParamDecl, it: *Node.Iterator) ?*Node { | 1059 | pub fn iterateNext(self: *const ParamDecl, it: *Node.Iterator) ?*Node { |
| ... | @@ -1098,7 +1101,7 @@ pub const Node = struct { | ... | @@ -1098,7 +1101,7 @@ pub const Node = struct { |
| 1098 | } | 1101 | } |
| 1099 | | 1102 | |
| 1100 | pub fn iterate(self: *const FnProto) Node.Iterator { | 1103 | pub fn iterate(self: *const FnProto) Node.Iterator { |
| 1101 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1104 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1102 | } | 1105 | } |
| 1103 | | 1106 | |
| 1104 | pub fn iterateNext(self: *const FnProto, it: *Node.Iterator) ?*Node { | 1107 | pub fn iterateNext(self: *const FnProto, it: *Node.Iterator) ?*Node { |
| ... | @@ -1189,7 +1192,7 @@ pub const Node = struct { | ... | @@ -1189,7 +1192,7 @@ pub const Node = struct { |
| 1189 | }; | 1192 | }; |
| 1190 | | 1193 | |
| 1191 | pub fn iterate(self: *const AnyFrameType) Node.Iterator { | 1194 | pub fn iterate(self: *const AnyFrameType) Node.Iterator { |
| 1192 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1195 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1193 | } | 1196 | } |
| 1194 | | 1197 | |
| 1195 | pub fn iterateNext(self: *const AnyFrameType, it: *Node.Iterator) ?*Node { | 1198 | pub fn iterateNext(self: *const AnyFrameType, it: *Node.Iterator) ?*Node { |
| ... | @@ -1234,7 +1237,7 @@ pub const Node = struct { | ... | @@ -1234,7 +1237,7 @@ pub const Node = struct { |
| 1234 | } | 1237 | } |
| 1235 | | 1238 | |
| 1236 | pub fn iterate(self: *const Block) Node.Iterator { | 1239 | pub fn iterate(self: *const Block) Node.Iterator { |
| 1237 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1240 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1238 | } | 1241 | } |
| 1239 | | 1242 | |
| 1240 | pub fn iterateNext(self: *const Block, it: *Node.Iterator) ?*Node { | 1243 | pub fn iterateNext(self: *const Block, it: *Node.Iterator) ?*Node { |
| ... | @@ -1281,7 +1284,7 @@ pub const Node = struct { | ... | @@ -1281,7 +1284,7 @@ pub const Node = struct { |
| 1281 | expr: *Node, | 1284 | expr: *Node, |
| 1282 | | 1285 | |
| 1283 | pub fn iterate(self: *const Defer) Node.Iterator { | 1286 | pub fn iterate(self: *const Defer) Node.Iterator { |
| 1284 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1287 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1285 | } | 1288 | } |
| 1286 | | 1289 | |
| 1287 | pub fn iterateNext(self: *const Defer, it: *Node.Iterator) ?*Node { | 1290 | pub fn iterateNext(self: *const Defer, it: *Node.Iterator) ?*Node { |
| ... | @@ -1310,7 +1313,7 @@ pub const Node = struct { | ... | @@ -1310,7 +1313,7 @@ pub const Node = struct { |
| 1310 | expr: *Node, | 1313 | expr: *Node, |
| 1311 | | 1314 | |
| 1312 | pub fn iterate(self: *const Comptime) Node.Iterator { | 1315 | pub fn iterate(self: *const Comptime) Node.Iterator { |
| 1313 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1316 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1314 | } | 1317 | } |
| 1315 | | 1318 | |
| 1316 | pub fn iterateNext(self: *const Comptime, it: *Node.Iterator) ?*Node { | 1319 | pub fn iterateNext(self: *const Comptime, it: *Node.Iterator) ?*Node { |
| ... | @@ -1338,7 +1341,7 @@ pub const Node = struct { | ... | @@ -1338,7 +1341,7 @@ pub const Node = struct { |
| 1338 | expr: *Node, | 1341 | expr: *Node, |
| 1339 | | 1342 | |
| 1340 | pub fn iterate(self: *const Nosuspend) Node.Iterator { | 1343 | pub fn iterate(self: *const Nosuspend) Node.Iterator { |
| 1341 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1344 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1342 | } | 1345 | } |
| 1343 | | 1346 | |
| 1344 | pub fn iterateNext(self: *const Nosuspend, it: *Node.Iterator) ?*Node { | 1347 | pub fn iterateNext(self: *const Nosuspend, it: *Node.Iterator) ?*Node { |
| ... | @@ -1367,7 +1370,7 @@ pub const Node = struct { | ... | @@ -1367,7 +1370,7 @@ pub const Node = struct { |
| 1367 | rpipe: TokenIndex, | 1370 | rpipe: TokenIndex, |
| 1368 | | 1371 | |
| 1369 | pub fn iterate(self: *const Payload) Node.Iterator { | 1372 | pub fn iterate(self: *const Payload) Node.Iterator { |
| 1370 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1373 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1371 | } | 1374 | } |
| 1372 | | 1375 | |
| 1373 | pub fn iterateNext(self: *const Payload, it: *Node.Iterator) ?*Node { | 1376 | pub fn iterateNext(self: *const Payload, it: *Node.Iterator) ?*Node { |
| ... | @@ -1397,7 +1400,7 @@ pub const Node = struct { | ... | @@ -1397,7 +1400,7 @@ pub const Node = struct { |
| 1397 | rpipe: TokenIndex, | 1400 | rpipe: TokenIndex, |
| 1398 | | 1401 | |
| 1399 | pub fn iterate(self: *const PointerPayload) Node.Iterator { | 1402 | pub fn iterate(self: *const PointerPayload) Node.Iterator { |
| 1400 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1403 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1401 | } | 1404 | } |
| 1402 | | 1405 | |
| 1403 | pub fn iterateNext(self: *const PointerPayload, it: *Node.Iterator) ?*Node { | 1406 | pub fn iterateNext(self: *const PointerPayload, it: *Node.Iterator) ?*Node { |
| ... | @@ -1428,7 +1431,7 @@ pub const Node = struct { | ... | @@ -1428,7 +1431,7 @@ pub const Node = struct { |
| 1428 | rpipe: TokenIndex, | 1431 | rpipe: TokenIndex, |
| 1429 | | 1432 | |
| 1430 | pub fn iterate(self: *const PointerIndexPayload) Node.Iterator { | 1433 | pub fn iterate(self: *const PointerIndexPayload) Node.Iterator { |
| 1431 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1434 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1432 | } | 1435 | } |
| 1433 | | 1436 | |
| 1434 | pub fn iterateNext(self: *const PointerIndexPayload, it: *Node.Iterator) ?*Node { | 1437 | pub fn iterateNext(self: *const PointerIndexPayload, it: *Node.Iterator) ?*Node { |
| ... | @@ -1462,7 +1465,7 @@ pub const Node = struct { | ... | @@ -1462,7 +1465,7 @@ pub const Node = struct { |
| 1462 | body: *Node, | 1465 | body: *Node, |
| 1463 | | 1466 | |
| 1464 | pub fn iterate(self: *const Else) Node.Iterator { | 1467 | pub fn iterate(self: *const Else) Node.Iterator { |
| 1465 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1468 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1466 | } | 1469 | } |
| 1467 | | 1470 | |
| 1468 | pub fn iterateNext(self: *const Else, it: *Node.Iterator) ?*Node { | 1471 | pub fn iterateNext(self: *const Else, it: *Node.Iterator) ?*Node { |
| ... | @@ -1510,7 +1513,7 @@ pub const Node = struct { | ... | @@ -1510,7 +1513,7 @@ pub const Node = struct { |
| 1510 | } | 1513 | } |
| 1511 | | 1514 | |
| 1512 | pub fn iterate(self: *const Switch) Node.Iterator { | 1515 | pub fn iterate(self: *const Switch) Node.Iterator { |
| 1513 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1516 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1514 | } | 1517 | } |
| 1515 | | 1518 | |
| 1516 | pub fn iterateNext(self: *const Switch, it: *Node.Iterator) ?*Node { | 1519 | pub fn iterateNext(self: *const Switch, it: *Node.Iterator) ?*Node { |
| ... | @@ -1520,11 +1523,8 @@ pub const Node = struct { | ... | @@ -1520,11 +1523,8 @@ pub const Node = struct { |
| 1520 | if (i < 1) return self.expr; | 1523 | if (i < 1) return self.expr; |
| 1521 | i -= 1; | 1524 | i -= 1; |
| 1522 | | 1525 | |
| 1523 | if (it.node) |child| { | 1526 | if (i < self.cases_len) return self.casesConst()[i]; |
| 1524 | it.index -= 1; | 1527 | i -= self.cases_len; |
| 1525 | it.node = child.next; | | |
| 1526 | return child.data; | | |
| 1527 | } | | |
| 1528 | | 1528 | |
| 1529 | return null; | 1529 | return null; |
| 1530 | } | 1530 | } |
| ... | @@ -1572,7 +1572,7 @@ pub const Node = struct { | ... | @@ -1572,7 +1572,7 @@ pub const Node = struct { |
| 1572 | } | 1572 | } |
| 1573 | | 1573 | |
| 1574 | pub fn iterate(self: *const SwitchCase) Node.Iterator { | 1574 | pub fn iterate(self: *const SwitchCase) Node.Iterator { |
| 1575 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1575 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1576 | } | 1576 | } |
| 1577 | | 1577 | |
| 1578 | pub fn iterateNext(self: *const SwitchCase, it: *Node.Iterator) ?*Node { | 1578 | pub fn iterateNext(self: *const SwitchCase, it: *Node.Iterator) ?*Node { |
| ... | @@ -1621,7 +1621,7 @@ pub const Node = struct { | ... | @@ -1621,7 +1621,7 @@ pub const Node = struct { |
| 1621 | token: TokenIndex, | 1621 | token: TokenIndex, |
| 1622 | | 1622 | |
| 1623 | pub fn iterate(self: *const SwitchElse) Node.Iterator { | 1623 | pub fn iterate(self: *const SwitchElse) Node.Iterator { |
| 1624 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1624 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1625 | } | 1625 | } |
| 1626 | | 1626 | |
| 1627 | pub fn iterateNext(self: *const SwitchElse, it: *Node.Iterator) ?*Node { | 1627 | pub fn iterateNext(self: *const SwitchElse, it: *Node.Iterator) ?*Node { |
| ... | @@ -1649,7 +1649,7 @@ pub const Node = struct { | ... | @@ -1649,7 +1649,7 @@ pub const Node = struct { |
| 1649 | @"else": ?*Else, | 1649 | @"else": ?*Else, |
| 1650 | | 1650 | |
| 1651 | pub fn iterate(self: *const While) Node.Iterator { | 1651 | pub fn iterate(self: *const While) Node.Iterator { |
| 1652 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1652 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1653 | } | 1653 | } |
| 1654 | | 1654 | |
| 1655 | pub fn iterateNext(self: *const While, it: *Node.Iterator) ?*Node { | 1655 | pub fn iterateNext(self: *const While, it: *Node.Iterator) ?*Node { |
| ... | @@ -1712,7 +1712,7 @@ pub const Node = struct { | ... | @@ -1712,7 +1712,7 @@ pub const Node = struct { |
| 1712 | @"else": ?*Else, | 1712 | @"else": ?*Else, |
| 1713 | | 1713 | |
| 1714 | pub fn iterate(self: *const For) Node.Iterator { | 1714 | pub fn iterate(self: *const For) Node.Iterator { |
| 1715 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1715 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1716 | } | 1716 | } |
| 1717 | | 1717 | |
| 1718 | pub fn iterateNext(self: *const For, it: *Node.Iterator) ?*Node { | 1718 | pub fn iterateNext(self: *const For, it: *Node.Iterator) ?*Node { |
| ... | @@ -1766,7 +1766,7 @@ pub const Node = struct { | ... | @@ -1766,7 +1766,7 @@ pub const Node = struct { |
| 1766 | @"else": ?*Else, | 1766 | @"else": ?*Else, |
| 1767 | | 1767 | |
| 1768 | pub fn iterate(self: *const If) Node.Iterator { | 1768 | pub fn iterate(self: *const If) Node.Iterator { |
| 1769 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1769 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1770 | } | 1770 | } |
| 1771 | | 1771 | |
| 1772 | pub fn iterateNext(self: *const If, it: *Node.Iterator) ?*Node { | 1772 | pub fn iterateNext(self: *const If, it: *Node.Iterator) ?*Node { |
| ... | @@ -1859,7 +1859,7 @@ pub const Node = struct { | ... | @@ -1859,7 +1859,7 @@ pub const Node = struct { |
| 1859 | }; | 1859 | }; |
| 1860 | | 1860 | |
| 1861 | pub fn iterate(self: *const InfixOp) Node.Iterator { | 1861 | pub fn iterate(self: *const InfixOp) Node.Iterator { |
| 1862 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1862 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1863 | } | 1863 | } |
| 1864 | | 1864 | |
| 1865 | pub fn iterateNext(self: *const InfixOp, it: *Node.Iterator) ?*Node { | 1865 | pub fn iterateNext(self: *const InfixOp, it: *Node.Iterator) ?*Node { |
| ... | @@ -1982,7 +1982,7 @@ pub const Node = struct { | ... | @@ -1982,7 +1982,7 @@ pub const Node = struct { |
| 1982 | }; | 1982 | }; |
| 1983 | | 1983 | |
| 1984 | pub fn iterate(self: *const PrefixOp) Node.Iterator { | 1984 | pub fn iterate(self: *const PrefixOp) Node.Iterator { |
| 1985 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 1985 | return .{ .parent_node = &self.base, .index = 0 }; |
| 1986 | } | 1986 | } |
| 1987 | | 1987 | |
| 1988 | pub fn iterateNext(self: *const PrefixOp, it: *Node.Iterator) ?*Node { | 1988 | pub fn iterateNext(self: *const PrefixOp, it: *Node.Iterator) ?*Node { |
| ... | @@ -2045,7 +2045,7 @@ pub const Node = struct { | ... | @@ -2045,7 +2045,7 @@ pub const Node = struct { |
| 2045 | expr: *Node, | 2045 | expr: *Node, |
| 2046 | | 2046 | |
| 2047 | pub fn iterate(self: *const FieldInitializer) Node.Iterator { | 2047 | pub fn iterate(self: *const FieldInitializer) Node.Iterator { |
| 2048 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2048 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2049 | } | 2049 | } |
| 2050 | | 2050 | |
| 2051 | pub fn iterateNext(self: *const FieldInitializer, it: *Node.Iterator) ?*Node { | 2051 | pub fn iterateNext(self: *const FieldInitializer, it: *Node.Iterator) ?*Node { |
| ... | @@ -2086,7 +2086,7 @@ pub const Node = struct { | ... | @@ -2086,7 +2086,7 @@ pub const Node = struct { |
| 2086 | } | 2086 | } |
| 2087 | | 2087 | |
| 2088 | pub fn iterate(self: *const ArrayInitializer) Node.Iterator { | 2088 | pub fn iterate(self: *const ArrayInitializer) Node.Iterator { |
| 2089 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2089 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2090 | } | 2090 | } |
| 2091 | | 2091 | |
| 2092 | pub fn iterateNext(self: *const ArrayInitializer, it: *Node.Iterator) ?*Node { | 2092 | pub fn iterateNext(self: *const ArrayInitializer, it: *Node.Iterator) ?*Node { |
| ... | @@ -2144,7 +2144,7 @@ pub const Node = struct { | ... | @@ -2144,7 +2144,7 @@ pub const Node = struct { |
| 2144 | } | 2144 | } |
| 2145 | | 2145 | |
| 2146 | pub fn iterate(self: *const ArrayInitializerDot) Node.Iterator { | 2146 | pub fn iterate(self: *const ArrayInitializerDot) Node.Iterator { |
| 2147 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2147 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2148 | } | 2148 | } |
| 2149 | | 2149 | |
| 2150 | pub fn iterateNext(self: *const ArrayInitializerDot, it: *Node.Iterator) ?*Node { | 2150 | pub fn iterateNext(self: *const ArrayInitializerDot, it: *Node.Iterator) ?*Node { |
| ... | @@ -2199,7 +2199,7 @@ pub const Node = struct { | ... | @@ -2199,7 +2199,7 @@ pub const Node = struct { |
| 2199 | } | 2199 | } |
| 2200 | | 2200 | |
| 2201 | pub fn iterate(self: *const StructInitializer) Node.Iterator { | 2201 | pub fn iterate(self: *const StructInitializer) Node.Iterator { |
| 2202 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2202 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2203 | } | 2203 | } |
| 2204 | | 2204 | |
| 2205 | pub fn iterateNext(self: *const StructInitializer, it: *Node.Iterator) ?*Node { | 2205 | pub fn iterateNext(self: *const StructInitializer, it: *Node.Iterator) ?*Node { |
| ... | @@ -2257,7 +2257,7 @@ pub const Node = struct { | ... | @@ -2257,7 +2257,7 @@ pub const Node = struct { |
| 2257 | } | 2257 | } |
| 2258 | | 2258 | |
| 2259 | pub fn iterate(self: *const StructInitializerDot) Node.Iterator { | 2259 | pub fn iterate(self: *const StructInitializerDot) Node.Iterator { |
| 2260 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2260 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2261 | } | 2261 | } |
| 2262 | | 2262 | |
| 2263 | pub fn iterateNext(self: *const StructInitializerDot, it: *Node.Iterator) ?*Node { | 2263 | pub fn iterateNext(self: *const StructInitializerDot, it: *Node.Iterator) ?*Node { |
| ... | @@ -2313,7 +2313,7 @@ pub const Node = struct { | ... | @@ -2313,7 +2313,7 @@ pub const Node = struct { |
| 2313 | } | 2313 | } |
| 2314 | | 2314 | |
| 2315 | pub fn iterate(self: *const Call) Node.Iterator { | 2315 | pub fn iterate(self: *const Call) Node.Iterator { |
| 2316 | return .{ .parent_node = &self.base, .index = 0, .node = null}; | 2316 | return .{ .parent_node = &self.base, .index = 0}; |
| 2317 | } | 2317 | } |
| 2318 | | 2318 | |
| 2319 | pub fn iterateNext(self: *const Call, it: *Node.Iterator) ?*Node { | 2319 | pub fn iterateNext(self: *const Call, it: *Node.Iterator) ?*Node { |
| ... | @@ -2373,7 +2373,7 @@ pub const Node = struct { | ... | @@ -2373,7 +2373,7 @@ pub const Node = struct { |
| 2373 | }; | 2373 | }; |
| 2374 | | 2374 | |
| 2375 | pub fn iterate(self: *const SuffixOp) Node.Iterator { | 2375 | pub fn iterate(self: *const SuffixOp) Node.Iterator { |
| 2376 | return .{ .parent_node = &self.base, .index = 0, .node = null}; | 2376 | return .{ .parent_node = &self.base, .index = 0}; |
| 2377 | } | 2377 | } |
| 2378 | | 2378 | |
| 2379 | pub fn iterateNext(self: *const SuffixOp, it: *Node.Iterator) ?*Node { | 2379 | pub fn iterateNext(self: *const SuffixOp, it: *Node.Iterator) ?*Node { |
| ... | @@ -2425,7 +2425,7 @@ pub const Node = struct { | ... | @@ -2425,7 +2425,7 @@ pub const Node = struct { |
| 2425 | rparen: TokenIndex, | 2425 | rparen: TokenIndex, |
| 2426 | | 2426 | |
| 2427 | pub fn iterate(self: *const GroupedExpression) Node.Iterator { | 2427 | pub fn iterate(self: *const GroupedExpression) Node.Iterator { |
| 2428 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2428 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2429 | } | 2429 | } |
| 2430 | | 2430 | |
| 2431 | pub fn iterateNext(self: *const GroupedExpression, it: *Node.Iterator) ?*Node { | 2431 | pub fn iterateNext(self: *const GroupedExpression, it: *Node.Iterator) ?*Node { |
| ... | @@ -2460,7 +2460,7 @@ pub const Node = struct { | ... | @@ -2460,7 +2460,7 @@ pub const Node = struct { |
| 2460 | }; | 2460 | }; |
| 2461 | | 2461 | |
| 2462 | pub fn iterate(self: *const ControlFlowExpression) Node.Iterator { | 2462 | pub fn iterate(self: *const ControlFlowExpression) Node.Iterator { |
| 2463 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2463 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2464 | } | 2464 | } |
| 2465 | | 2465 | |
| 2466 | pub fn iterateNext(self: *const ControlFlowExpression, it: *Node.Iterator) ?*Node { | 2466 | pub fn iterateNext(self: *const ControlFlowExpression, it: *Node.Iterator) ?*Node { |
| ... | @@ -2513,7 +2513,7 @@ pub const Node = struct { | ... | @@ -2513,7 +2513,7 @@ pub const Node = struct { |
| 2513 | body: ?*Node, | 2513 | body: ?*Node, |
| 2514 | | 2514 | |
| 2515 | pub fn iterate(self: *const Suspend) Node.Iterator { | 2515 | pub fn iterate(self: *const Suspend) Node.Iterator { |
| 2516 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2516 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2517 | } | 2517 | } |
| 2518 | | 2518 | |
| 2519 | pub fn iterateNext(self: *const Suspend, it: *Node.Iterator) ?*Node { | 2519 | pub fn iterateNext(self: *const Suspend, it: *Node.Iterator) ?*Node { |
| ... | @@ -2546,7 +2546,7 @@ pub const Node = struct { | ... | @@ -2546,7 +2546,7 @@ pub const Node = struct { |
| 2546 | token: TokenIndex, | 2546 | token: TokenIndex, |
| 2547 | | 2547 | |
| 2548 | pub fn iterate(self: *const IntegerLiteral) Node.Iterator { | 2548 | pub fn iterate(self: *const IntegerLiteral) Node.Iterator { |
| 2549 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2549 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2550 | } | 2550 | } |
| 2551 | | 2551 | |
| 2552 | pub fn iterateNext(self: *const IntegerLiteral, it: *Node.Iterator) ?*Node { | 2552 | pub fn iterateNext(self: *const IntegerLiteral, it: *Node.Iterator) ?*Node { |
| ... | @@ -2568,7 +2568,7 @@ pub const Node = struct { | ... | @@ -2568,7 +2568,7 @@ pub const Node = struct { |
| 2568 | name: TokenIndex, | 2568 | name: TokenIndex, |
| 2569 | | 2569 | |
| 2570 | pub fn iterate(self: *const EnumLiteral) Node.Iterator { | 2570 | pub fn iterate(self: *const EnumLiteral) Node.Iterator { |
| 2571 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2571 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2572 | } | 2572 | } |
| 2573 | | 2573 | |
| 2574 | pub fn iterateNext(self: *const EnumLiteral, it: *Node.Iterator) ?*Node { | 2574 | pub fn iterateNext(self: *const EnumLiteral, it: *Node.Iterator) ?*Node { |
| ... | @@ -2589,7 +2589,7 @@ pub const Node = struct { | ... | @@ -2589,7 +2589,7 @@ pub const Node = struct { |
| 2589 | token: TokenIndex, | 2589 | token: TokenIndex, |
| 2590 | | 2590 | |
| 2591 | pub fn iterate(self: *const FloatLiteral) Node.Iterator { | 2591 | pub fn iterate(self: *const FloatLiteral) Node.Iterator { |
| 2592 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2592 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2593 | } | 2593 | } |
| 2594 | | 2594 | |
| 2595 | pub fn iterateNext(self: *const FloatLiteral, it: *Node.Iterator) ?*Node { | 2595 | pub fn iterateNext(self: *const FloatLiteral, it: *Node.Iterator) ?*Node { |
| ... | @@ -2624,7 +2624,7 @@ pub const Node = struct { | ... | @@ -2624,7 +2624,7 @@ pub const Node = struct { |
| 2624 | } | 2624 | } |
| 2625 | | 2625 | |
| 2626 | pub fn iterate(self: *const BuiltinCall) Node.Iterator { | 2626 | pub fn iterate(self: *const BuiltinCall) Node.Iterator { |
| 2627 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2627 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2628 | } | 2628 | } |
| 2629 | | 2629 | |
| 2630 | pub fn iterateNext(self: *const BuiltinCall, it: *Node.Iterator) ?*Node { | 2630 | pub fn iterateNext(self: *const BuiltinCall, it: *Node.Iterator) ?*Node { |
| ... | @@ -2665,7 +2665,7 @@ pub const Node = struct { | ... | @@ -2665,7 +2665,7 @@ pub const Node = struct { |
| 2665 | token: TokenIndex, | 2665 | token: TokenIndex, |
| 2666 | | 2666 | |
| 2667 | pub fn iterate(self: *const StringLiteral) Node.Iterator { | 2667 | pub fn iterate(self: *const StringLiteral) Node.Iterator { |
| 2668 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2668 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2669 | } | 2669 | } |
| 2670 | | 2670 | |
| 2671 | pub fn iterateNext(self: *const StringLiteral, it: *Node.Iterator) ?*Node { | 2671 | pub fn iterateNext(self: *const StringLiteral, it: *Node.Iterator) ?*Node { |
| ... | @@ -2681,14 +2681,24 @@ pub const Node = struct { | ... | @@ -2681,14 +2681,24 @@ pub const Node = struct { |
| 2681 | } | 2681 | } |
| 2682 | }; | 2682 | }; |
| 2683 | | 2683 | |
| | 2684 | /// The string literal tokens appear directly in memory after MultilineStringLiteral. |
| 2684 | pub const MultilineStringLiteral = struct { | 2685 | pub const MultilineStringLiteral = struct { |
| 2685 | base: Node = Node{ .id = .MultilineStringLiteral }, | 2686 | base: Node = Node{ .id = .MultilineStringLiteral }, |
| 2686 | lines: LineList, | 2687 | lines_len: TokenIndex, |
| 2687 | | 2688 | |
| 2688 | pub const LineList = LinkedList(TokenIndex); | 2689 | /// After this the caller must initialize the lines list. |
| | 2690 | pub fn alloc(allocator: *mem.Allocator, lines_len: NodeIndex) !*MultilineStringLiteral { |
| | 2691 | const bytes = try allocator.alignedAlloc(u8, @alignOf(MultilineStringLiteral), sizeInBytes(lines_len)); |
| | 2692 | return @ptrCast(*MultilineStringLiteral, bytes.ptr); |
| | 2693 | } |
| | 2694 | |
| | 2695 | pub fn free(self: *MultilineStringLiteral, allocator: *mem.Allocator) void { |
| | 2696 | const bytes = @ptrCast([*]u8, self)[0..sizeInBytes(self.lines_len)]; |
| | 2697 | allocator.free(bytes); |
| | 2698 | } |
| 2689 | | 2699 | |
| 2690 | pub fn iterate(self: *const MultilineStringLiteral) Node.Iterator { | 2700 | pub fn iterate(self: *const MultilineStringLiteral) Node.Iterator { |
| 2691 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2701 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2692 | } | 2702 | } |
| 2693 | | 2703 | |
| 2694 | pub fn iterateNext(self: *const MultilineStringLiteral, it: *Node.Iterator) ?*Node { | 2704 | pub fn iterateNext(self: *const MultilineStringLiteral, it: *Node.Iterator) ?*Node { |
| ... | @@ -2696,14 +2706,25 @@ pub const Node = struct { | ... | @@ -2696,14 +2706,25 @@ pub const Node = struct { |
| 2696 | } | 2706 | } |
| 2697 | | 2707 | |
| 2698 | pub fn firstToken(self: *const MultilineStringLiteral) TokenIndex { | 2708 | pub fn firstToken(self: *const MultilineStringLiteral) TokenIndex { |
| 2699 | return self.lines.first.?.data; | 2709 | return self.linesConst()[0]; |
| 2700 | } | 2710 | } |
| 2701 | | 2711 | |
| 2702 | pub fn lastToken(self: *const MultilineStringLiteral) TokenIndex { | 2712 | pub fn lastToken(self: *const MultilineStringLiteral) TokenIndex { |
| 2703 | var node = self.lines.first.?; | 2713 | return self.linesConst()[self.lines_len - 1]; |
| 2704 | while (true) { | 2714 | } |
| 2705 | node = node.next orelse return node.data; | 2715 | |
| 2706 | } | 2716 | pub fn lines(self: *MultilineStringLiteral) []TokenIndex { |
| | 2717 | const decls_start = @ptrCast([*]u8, self) + @sizeOf(MultilineStringLiteral); |
| | 2718 | return @ptrCast([*]TokenIndex, decls_start)[0..self.lines_len]; |
| | 2719 | } |
| | 2720 | |
| | 2721 | pub fn linesConst(self: *const MultilineStringLiteral) []const TokenIndex { |
| | 2722 | const decls_start = @ptrCast([*]const u8, self) + @sizeOf(MultilineStringLiteral); |
| | 2723 | return @ptrCast([*]const TokenIndex, decls_start)[0..self.lines_len]; |
| | 2724 | } |
| | 2725 | |
| | 2726 | fn sizeInBytes(lines_len: NodeIndex) usize { |
| | 2727 | return @sizeOf(MultilineStringLiteral) + @sizeOf(TokenIndex) * @as(usize, lines_len); |
| 2707 | } | 2728 | } |
| 2708 | }; | 2729 | }; |
| 2709 | | 2730 | |
| ... | @@ -2712,7 +2733,7 @@ pub const Node = struct { | ... | @@ -2712,7 +2733,7 @@ pub const Node = struct { |
| 2712 | token: TokenIndex, | 2733 | token: TokenIndex, |
| 2713 | | 2734 | |
| 2714 | pub fn iterate(self: *const CharLiteral) Node.Iterator { | 2735 | pub fn iterate(self: *const CharLiteral) Node.Iterator { |
| 2715 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2736 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2716 | } | 2737 | } |
| 2717 | | 2738 | |
| 2718 | pub fn iterateNext(self: *const CharLiteral, it: *Node.Iterator) ?*Node { | 2739 | pub fn iterateNext(self: *const CharLiteral, it: *Node.Iterator) ?*Node { |
| ... | @@ -2733,7 +2754,7 @@ pub const Node = struct { | ... | @@ -2733,7 +2754,7 @@ pub const Node = struct { |
| 2733 | token: TokenIndex, | 2754 | token: TokenIndex, |
| 2734 | | 2755 | |
| 2735 | pub fn iterate(self: *const BoolLiteral) Node.Iterator { | 2756 | pub fn iterate(self: *const BoolLiteral) Node.Iterator { |
| 2736 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2757 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2737 | } | 2758 | } |
| 2738 | | 2759 | |
| 2739 | pub fn iterateNext(self: *const BoolLiteral, it: *Node.Iterator) ?*Node { | 2760 | pub fn iterateNext(self: *const BoolLiteral, it: *Node.Iterator) ?*Node { |
| ... | @@ -2754,7 +2775,7 @@ pub const Node = struct { | ... | @@ -2754,7 +2775,7 @@ pub const Node = struct { |
| 2754 | token: TokenIndex, | 2775 | token: TokenIndex, |
| 2755 | | 2776 | |
| 2756 | pub fn iterate(self: *const NullLiteral) Node.Iterator { | 2777 | pub fn iterate(self: *const NullLiteral) Node.Iterator { |
| 2757 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2778 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2758 | } | 2779 | } |
| 2759 | | 2780 | |
| 2760 | pub fn iterateNext(self: *const NullLiteral, it: *Node.Iterator) ?*Node { | 2781 | pub fn iterateNext(self: *const NullLiteral, it: *Node.Iterator) ?*Node { |
| ... | @@ -2775,7 +2796,7 @@ pub const Node = struct { | ... | @@ -2775,7 +2796,7 @@ pub const Node = struct { |
| 2775 | token: TokenIndex, | 2796 | token: TokenIndex, |
| 2776 | | 2797 | |
| 2777 | pub fn iterate(self: *const UndefinedLiteral) Node.Iterator { | 2798 | pub fn iterate(self: *const UndefinedLiteral) Node.Iterator { |
| 2778 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2799 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2779 | } | 2800 | } |
| 2780 | | 2801 | |
| 2781 | pub fn iterateNext(self: *const UndefinedLiteral, it: *Node.Iterator) ?*Node { | 2802 | pub fn iterateNext(self: *const UndefinedLiteral, it: *Node.Iterator) ?*Node { |
| ... | @@ -2815,7 +2836,7 @@ pub const Node = struct { | ... | @@ -2815,7 +2836,7 @@ pub const Node = struct { |
| 2815 | }; | 2836 | }; |
| 2816 | | 2837 | |
| 2817 | pub fn iterate(self: *const Output) Node.Iterator { | 2838 | pub fn iterate(self: *const Output) Node.Iterator { |
| 2818 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2839 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2819 | } | 2840 | } |
| 2820 | | 2841 | |
| 2821 | pub fn iterateNext(self: *const Output, it: *Node.Iterator) ?*Node { | 2842 | pub fn iterateNext(self: *const Output, it: *Node.Iterator) ?*Node { |
| ... | @@ -2859,7 +2880,7 @@ pub const Node = struct { | ... | @@ -2859,7 +2880,7 @@ pub const Node = struct { |
| 2859 | rparen: TokenIndex, | 2880 | rparen: TokenIndex, |
| 2860 | | 2881 | |
| 2861 | pub fn iterate(self: *const Input) Node.Iterator { | 2882 | pub fn iterate(self: *const Input) Node.Iterator { |
| 2862 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2883 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2863 | } | 2884 | } |
| 2864 | | 2885 | |
| 2865 | pub fn iterateNext(self: *const Input, it: *Node.Iterator) ?*Node { | 2886 | pub fn iterateNext(self: *const Input, it: *Node.Iterator) ?*Node { |
| ... | @@ -2889,7 +2910,7 @@ pub const Node = struct { | ... | @@ -2889,7 +2910,7 @@ pub const Node = struct { |
| 2889 | | 2910 | |
| 2890 | | 2911 | |
| 2891 | pub fn iterate(self: *const Asm) Node.Iterator { | 2912 | pub fn iterate(self: *const Asm) Node.Iterator { |
| 2892 | return .{ .parent_node = &self.base, .index = 0, .node = null}; | 2913 | return .{ .parent_node = &self.base, .index = 0}; |
| 2893 | } | 2914 | } |
| 2894 | | 2915 | |
| 2895 | pub fn iterateNext(self: *const Asm, it: *Node.Iterator) ?*Node { | 2916 | pub fn iterateNext(self: *const Asm, it: *Node.Iterator) ?*Node { |
| ... | @@ -2932,7 +2953,7 @@ pub const Node = struct { | ... | @@ -2932,7 +2953,7 @@ pub const Node = struct { |
| 2932 | token: TokenIndex, | 2953 | token: TokenIndex, |
| 2933 | | 2954 | |
| 2934 | pub fn iterate(self: *const Unreachable) Node.Iterator { | 2955 | pub fn iterate(self: *const Unreachable) Node.Iterator { |
| 2935 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2956 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2936 | } | 2957 | } |
| 2937 | | 2958 | |
| 2938 | pub fn iterateNext(self: *const Unreachable, it: *Node.Iterator) ?*Node { | 2959 | pub fn iterateNext(self: *const Unreachable, it: *Node.Iterator) ?*Node { |
| ... | @@ -2953,7 +2974,7 @@ pub const Node = struct { | ... | @@ -2953,7 +2974,7 @@ pub const Node = struct { |
| 2953 | token: TokenIndex, | 2974 | token: TokenIndex, |
| 2954 | | 2975 | |
| 2955 | pub fn iterate(self: *const ErrorType) Node.Iterator { | 2976 | pub fn iterate(self: *const ErrorType) Node.Iterator { |
| 2956 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2977 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2957 | } | 2978 | } |
| 2958 | | 2979 | |
| 2959 | pub fn iterateNext(self: *const ErrorType, it: *Node.Iterator) ?*Node { | 2980 | pub fn iterateNext(self: *const ErrorType, it: *Node.Iterator) ?*Node { |
| ... | @@ -2974,7 +2995,7 @@ pub const Node = struct { | ... | @@ -2974,7 +2995,7 @@ pub const Node = struct { |
| 2974 | token: TokenIndex, | 2995 | token: TokenIndex, |
| 2975 | | 2996 | |
| 2976 | pub fn iterate(self: *const VarType) Node.Iterator { | 2997 | pub fn iterate(self: *const VarType) Node.Iterator { |
| 2977 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 2998 | return .{ .parent_node = &self.base, .index = 0 }; |
| 2978 | } | 2999 | } |
| 2979 | | 3000 | |
| 2980 | pub fn iterateNext(self: *const VarType, it: *Node.Iterator) ?*Node { | 3001 | pub fn iterateNext(self: *const VarType, it: *Node.Iterator) ?*Node { |
| ... | @@ -2997,7 +3018,7 @@ pub const Node = struct { | ... | @@ -2997,7 +3018,7 @@ pub const Node = struct { |
| 2997 | pub const LineList = LinkedList(TokenIndex); | 3018 | pub const LineList = LinkedList(TokenIndex); |
| 2998 | | 3019 | |
| 2999 | pub fn iterate(self: *const DocComment) Node.Iterator { | 3020 | pub fn iterate(self: *const DocComment) Node.Iterator { |
| 3000 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 3021 | return .{ .parent_node = &self.base, .index = 0 }; |
| 3001 | } | 3022 | } |
| 3002 | | 3023 | |
| 3003 | pub fn iterateNext(self: *const DocComment, it: *Node.Iterator) ?*Node { | 3024 | pub fn iterateNext(self: *const DocComment, it: *Node.Iterator) ?*Node { |
| ... | @@ -3024,7 +3045,7 @@ pub const Node = struct { | ... | @@ -3024,7 +3045,7 @@ pub const Node = struct { |
| 3024 | body_node: *Node, | 3045 | body_node: *Node, |
| 3025 | | 3046 | |
| 3026 | pub fn iterate(self: *const TestDecl) Node.Iterator { | 3047 | pub fn iterate(self: *const TestDecl) Node.Iterator { |
| 3027 | return .{ .parent_node = &self.base, .index = 0, .node = null }; | 3048 | return .{ .parent_node = &self.base, .index = 0 }; |
| 3028 | } | 3049 | } |
| 3029 | | 3050 | |
| 3030 | pub fn iterateNext(self: *const TestDecl, it: *Node.Iterator) ?*Node { | 3051 | pub fn iterateNext(self: *const TestDecl, it: *Node.Iterator) ?*Node { |