| ... | ... | @@ -16,7 +16,7 @@ const assert = std.debug.assert; |
| 16 | 16 | const testing = std.testing; |
| 17 | 17 | const mem = std.mem; |
| 18 | 18 | const Token = std.zig.Token; |
| 19 | | const Tree = @This(); |
| 19 | const Ast = @This(); |
| 20 | 20 | |
| 21 | 21 | pub const TokenIndex = u32; |
| 22 | 22 | pub const ByteOffset = u32; |
| ... | ... | @@ -34,7 +34,7 @@ pub const Location = struct { |
| 34 | 34 | line_end: usize, |
| 35 | 35 | }; |
| 36 | 36 | |
| 37 | | pub fn deinit(tree: *Tree, gpa: mem.Allocator) void { |
| 37 | pub fn deinit(tree: *Ast, gpa: mem.Allocator) void { |
| 38 | 38 | tree.tokens.deinit(gpa); |
| 39 | 39 | tree.nodes.deinit(gpa); |
| 40 | 40 | gpa.free(tree.extra_data); |
| ... | ... | @@ -52,7 +52,7 @@ pub const RenderError = error{ |
| 52 | 52 | /// for allocating extra stack memory if needed, because this function utilizes recursion. |
| 53 | 53 | /// Note: that's not actually true yet, see https://github.com/ziglang/zig/issues/1006. |
| 54 | 54 | /// Caller owns the returned slice of bytes, allocated with `gpa`. |
| 55 | | pub fn render(tree: Tree, gpa: mem.Allocator) RenderError![]u8 { |
| 55 | pub fn render(tree: Ast, gpa: mem.Allocator) RenderError![]u8 { |
| 56 | 56 | var buffer = std.ArrayList(u8).init(gpa); |
| 57 | 57 | defer buffer.deinit(); |
| 58 | 58 | |
| ... | ... | @@ -60,11 +60,11 @@ pub fn render(tree: Tree, gpa: mem.Allocator) RenderError![]u8 { |
| 60 | 60 | return buffer.toOwnedSlice(); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | | pub fn renderToArrayList(tree: Tree, buffer: *std.ArrayList(u8)) RenderError!void { |
| 63 | pub fn renderToArrayList(tree: Ast, buffer: *std.ArrayList(u8)) RenderError!void { |
| 64 | 64 | return @import("./render.zig").renderTree(buffer, tree); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | | pub fn tokenLocation(self: Tree, start_offset: ByteOffset, token_index: TokenIndex) Location { |
| 67 | pub fn tokenLocation(self: Ast, start_offset: ByteOffset, token_index: TokenIndex) Location { |
| 68 | 68 | var loc = Location{ |
| 69 | 69 | .line = 0, |
| 70 | 70 | .column = 0, |
| ... | ... | @@ -91,7 +91,7 @@ pub fn tokenLocation(self: Tree, start_offset: ByteOffset, token_index: TokenInd |
| 91 | 91 | return loc; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | | pub fn tokenSlice(tree: Tree, token_index: TokenIndex) []const u8 { |
| 94 | pub fn tokenSlice(tree: Ast, token_index: TokenIndex) []const u8 { |
| 95 | 95 | const token_starts = tree.tokens.items(.start); |
| 96 | 96 | const token_tags = tree.tokens.items(.tag); |
| 97 | 97 | const token_tag = token_tags[token_index]; |
| ... | ... | @@ -112,7 +112,7 @@ pub fn tokenSlice(tree: Tree, token_index: TokenIndex) []const u8 { |
| 112 | 112 | return tree.source[token.loc.start..token.loc.end]; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | | pub fn extraData(tree: Tree, index: usize, comptime T: type) T { |
| 115 | pub fn extraData(tree: Ast, index: usize, comptime T: type) T { |
| 116 | 116 | const fields = std.meta.fields(T); |
| 117 | 117 | var result: T = undefined; |
| 118 | 118 | inline for (fields) |field, i| { |
| ... | ... | @@ -122,13 +122,13 @@ pub fn extraData(tree: Tree, index: usize, comptime T: type) T { |
| 122 | 122 | return result; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | | pub fn rootDecls(tree: Tree) []const Node.Index { |
| 125 | pub fn rootDecls(tree: Ast) []const Node.Index { |
| 126 | 126 | // Root is always index 0. |
| 127 | 127 | const nodes_data = tree.nodes.items(.data); |
| 128 | 128 | return tree.extra_data[nodes_data[0].lhs..nodes_data[0].rhs]; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | | pub fn renderError(tree: Tree, parse_error: Error, stream: anytype) !void { |
| 131 | pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { |
| 132 | 132 | const token_tags = tree.tokens.items(.tag); |
| 133 | 133 | switch (parse_error.tag) { |
| 134 | 134 | .asterisk_after_ptr_deref => { |
| ... | ... | @@ -321,7 +321,7 @@ pub fn renderError(tree: Tree, parse_error: Error, stream: anytype) !void { |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | | pub fn firstToken(tree: Tree, node: Node.Index) TokenIndex { |
| 324 | pub fn firstToken(tree: Ast, node: Node.Index) TokenIndex { |
| 325 | 325 | const tags = tree.nodes.items(.tag); |
| 326 | 326 | const datas = tree.nodes.items(.data); |
| 327 | 327 | const main_tokens = tree.nodes.items(.main_token); |
| ... | ... | @@ -625,7 +625,7 @@ pub fn firstToken(tree: Tree, node: Node.Index) TokenIndex { |
| 625 | 625 | }; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | | pub fn lastToken(tree: Tree, node: Node.Index) TokenIndex { |
| 628 | pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 629 | 629 | const tags = tree.nodes.items(.tag); |
| 630 | 630 | const datas = tree.nodes.items(.data); |
| 631 | 631 | const main_tokens = tree.nodes.items(.main_token); |
| ... | ... | @@ -1157,13 +1157,13 @@ pub fn lastToken(tree: Tree, node: Node.Index) TokenIndex { |
| 1157 | 1157 | }; |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | | pub fn tokensOnSameLine(tree: Tree, token1: TokenIndex, token2: TokenIndex) bool { |
| 1160 | pub fn tokensOnSameLine(tree: Ast, token1: TokenIndex, token2: TokenIndex) bool { |
| 1161 | 1161 | const token_starts = tree.tokens.items(.start); |
| 1162 | 1162 | const source = tree.source[token_starts[token1]..token_starts[token2]]; |
| 1163 | 1163 | return mem.indexOfScalar(u8, source, '\n') == null; |
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | | pub fn getNodeSource(tree: Tree, node: Node.Index) []const u8 { |
| 1166 | pub fn getNodeSource(tree: Ast, node: Node.Index) []const u8 { |
| 1167 | 1167 | const token_starts = tree.tokens.items(.start); |
| 1168 | 1168 | const first_token = tree.firstToken(node); |
| 1169 | 1169 | const last_token = tree.lastToken(node); |
| ... | ... | @@ -1172,7 +1172,7 @@ pub fn getNodeSource(tree: Tree, node: Node.Index) []const u8 { |
| 1172 | 1172 | return tree.source[start..end]; |
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | | pub fn globalVarDecl(tree: Tree, node: Node.Index) full.VarDecl { |
| 1175 | pub fn globalVarDecl(tree: Ast, node: Node.Index) full.VarDecl { |
| 1176 | 1176 | assert(tree.nodes.items(.tag)[node] == .global_var_decl); |
| 1177 | 1177 | const data = tree.nodes.items(.data)[node]; |
| 1178 | 1178 | const extra = tree.extraData(data.lhs, Node.GlobalVarDecl); |
| ... | ... | @@ -1186,7 +1186,7 @@ pub fn globalVarDecl(tree: Tree, node: Node.Index) full.VarDecl { |
| 1186 | 1186 | }); |
| 1187 | 1187 | } |
| 1188 | 1188 | |
| 1189 | | pub fn localVarDecl(tree: Tree, node: Node.Index) full.VarDecl { |
| 1189 | pub fn localVarDecl(tree: Ast, node: Node.Index) full.VarDecl { |
| 1190 | 1190 | assert(tree.nodes.items(.tag)[node] == .local_var_decl); |
| 1191 | 1191 | const data = tree.nodes.items(.data)[node]; |
| 1192 | 1192 | const extra = tree.extraData(data.lhs, Node.LocalVarDecl); |
| ... | ... | @@ -1200,7 +1200,7 @@ pub fn localVarDecl(tree: Tree, node: Node.Index) full.VarDecl { |
| 1200 | 1200 | }); |
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | | pub fn simpleVarDecl(tree: Tree, node: Node.Index) full.VarDecl { |
| 1203 | pub fn simpleVarDecl(tree: Ast, node: Node.Index) full.VarDecl { |
| 1204 | 1204 | assert(tree.nodes.items(.tag)[node] == .simple_var_decl); |
| 1205 | 1205 | const data = tree.nodes.items(.data)[node]; |
| 1206 | 1206 | return tree.fullVarDecl(.{ |
| ... | ... | @@ -1213,7 +1213,7 @@ pub fn simpleVarDecl(tree: Tree, node: Node.Index) full.VarDecl { |
| 1213 | 1213 | }); |
| 1214 | 1214 | } |
| 1215 | 1215 | |
| 1216 | | pub fn alignedVarDecl(tree: Tree, node: Node.Index) full.VarDecl { |
| 1216 | pub fn alignedVarDecl(tree: Ast, node: Node.Index) full.VarDecl { |
| 1217 | 1217 | assert(tree.nodes.items(.tag)[node] == .aligned_var_decl); |
| 1218 | 1218 | const data = tree.nodes.items(.data)[node]; |
| 1219 | 1219 | return tree.fullVarDecl(.{ |
| ... | ... | @@ -1226,7 +1226,7 @@ pub fn alignedVarDecl(tree: Tree, node: Node.Index) full.VarDecl { |
| 1226 | 1226 | }); |
| 1227 | 1227 | } |
| 1228 | 1228 | |
| 1229 | | pub fn ifSimple(tree: Tree, node: Node.Index) full.If { |
| 1229 | pub fn ifSimple(tree: Ast, node: Node.Index) full.If { |
| 1230 | 1230 | assert(tree.nodes.items(.tag)[node] == .if_simple); |
| 1231 | 1231 | const data = tree.nodes.items(.data)[node]; |
| 1232 | 1232 | return tree.fullIf(.{ |
| ... | ... | @@ -1237,7 +1237,7 @@ pub fn ifSimple(tree: Tree, node: Node.Index) full.If { |
| 1237 | 1237 | }); |
| 1238 | 1238 | } |
| 1239 | 1239 | |
| 1240 | | pub fn ifFull(tree: Tree, node: Node.Index) full.If { |
| 1240 | pub fn ifFull(tree: Ast, node: Node.Index) full.If { |
| 1241 | 1241 | assert(tree.nodes.items(.tag)[node] == .@"if"); |
| 1242 | 1242 | const data = tree.nodes.items(.data)[node]; |
| 1243 | 1243 | const extra = tree.extraData(data.rhs, Node.If); |
| ... | ... | @@ -1249,7 +1249,7 @@ pub fn ifFull(tree: Tree, node: Node.Index) full.If { |
| 1249 | 1249 | }); |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | | pub fn containerField(tree: Tree, node: Node.Index) full.ContainerField { |
| 1252 | pub fn containerField(tree: Ast, node: Node.Index) full.ContainerField { |
| 1253 | 1253 | assert(tree.nodes.items(.tag)[node] == .container_field); |
| 1254 | 1254 | const data = tree.nodes.items(.data)[node]; |
| 1255 | 1255 | const extra = tree.extraData(data.rhs, Node.ContainerField); |
| ... | ... | @@ -1261,7 +1261,7 @@ pub fn containerField(tree: Tree, node: Node.Index) full.ContainerField { |
| 1261 | 1261 | }); |
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | | pub fn containerFieldInit(tree: Tree, node: Node.Index) full.ContainerField { |
| 1264 | pub fn containerFieldInit(tree: Ast, node: Node.Index) full.ContainerField { |
| 1265 | 1265 | assert(tree.nodes.items(.tag)[node] == .container_field_init); |
| 1266 | 1266 | const data = tree.nodes.items(.data)[node]; |
| 1267 | 1267 | return tree.fullContainerField(.{ |
| ... | ... | @@ -1272,7 +1272,7 @@ pub fn containerFieldInit(tree: Tree, node: Node.Index) full.ContainerField { |
| 1272 | 1272 | }); |
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | | pub fn containerFieldAlign(tree: Tree, node: Node.Index) full.ContainerField { |
| 1275 | pub fn containerFieldAlign(tree: Ast, node: Node.Index) full.ContainerField { |
| 1276 | 1276 | assert(tree.nodes.items(.tag)[node] == .container_field_align); |
| 1277 | 1277 | const data = tree.nodes.items(.data)[node]; |
| 1278 | 1278 | return tree.fullContainerField(.{ |
| ... | ... | @@ -1283,7 +1283,7 @@ pub fn containerFieldAlign(tree: Tree, node: Node.Index) full.ContainerField { |
| 1283 | 1283 | }); |
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | | pub fn fnProtoSimple(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.FnProto { |
| 1286 | pub fn fnProtoSimple(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.FnProto { |
| 1287 | 1287 | assert(tree.nodes.items(.tag)[node] == .fn_proto_simple); |
| 1288 | 1288 | const data = tree.nodes.items(.data)[node]; |
| 1289 | 1289 | buffer[0] = data.lhs; |
| ... | ... | @@ -1300,7 +1300,7 @@ pub fn fnProtoSimple(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full. |
| 1300 | 1300 | }); |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | | pub fn fnProtoMulti(tree: Tree, node: Node.Index) full.FnProto { |
| 1303 | pub fn fnProtoMulti(tree: Ast, node: Node.Index) full.FnProto { |
| 1304 | 1304 | assert(tree.nodes.items(.tag)[node] == .fn_proto_multi); |
| 1305 | 1305 | const data = tree.nodes.items(.data)[node]; |
| 1306 | 1306 | const params_range = tree.extraData(data.lhs, Node.SubRange); |
| ... | ... | @@ -1317,7 +1317,7 @@ pub fn fnProtoMulti(tree: Tree, node: Node.Index) full.FnProto { |
| 1317 | 1317 | }); |
| 1318 | 1318 | } |
| 1319 | 1319 | |
| 1320 | | pub fn fnProtoOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.FnProto { |
| 1320 | pub fn fnProtoOne(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.FnProto { |
| 1321 | 1321 | assert(tree.nodes.items(.tag)[node] == .fn_proto_one); |
| 1322 | 1322 | const data = tree.nodes.items(.data)[node]; |
| 1323 | 1323 | const extra = tree.extraData(data.lhs, Node.FnProtoOne); |
| ... | ... | @@ -1335,7 +1335,7 @@ pub fn fnProtoOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.FnP |
| 1335 | 1335 | }); |
| 1336 | 1336 | } |
| 1337 | 1337 | |
| 1338 | | pub fn fnProto(tree: Tree, node: Node.Index) full.FnProto { |
| 1338 | pub fn fnProto(tree: Ast, node: Node.Index) full.FnProto { |
| 1339 | 1339 | assert(tree.nodes.items(.tag)[node] == .fn_proto); |
| 1340 | 1340 | const data = tree.nodes.items(.data)[node]; |
| 1341 | 1341 | const extra = tree.extraData(data.lhs, Node.FnProto); |
| ... | ... | @@ -1352,7 +1352,7 @@ pub fn fnProto(tree: Tree, node: Node.Index) full.FnProto { |
| 1352 | 1352 | }); |
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | | pub fn structInitOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.StructInit { |
| 1355 | pub fn structInitOne(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.StructInit { |
| 1356 | 1356 | assert(tree.nodes.items(.tag)[node] == .struct_init_one or |
| 1357 | 1357 | tree.nodes.items(.tag)[node] == .struct_init_one_comma); |
| 1358 | 1358 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1365,7 +1365,7 @@ pub fn structInitOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full. |
| 1365 | 1365 | }); |
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | | pub fn structInitDotTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) full.StructInit { |
| 1368 | pub fn structInitDotTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.StructInit { |
| 1369 | 1369 | assert(tree.nodes.items(.tag)[node] == .struct_init_dot_two or |
| 1370 | 1370 | tree.nodes.items(.tag)[node] == .struct_init_dot_two_comma); |
| 1371 | 1371 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1383,7 +1383,7 @@ pub fn structInitDotTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) fu |
| 1383 | 1383 | }); |
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | | pub fn structInitDot(tree: Tree, node: Node.Index) full.StructInit { |
| 1386 | pub fn structInitDot(tree: Ast, node: Node.Index) full.StructInit { |
| 1387 | 1387 | assert(tree.nodes.items(.tag)[node] == .struct_init_dot or |
| 1388 | 1388 | tree.nodes.items(.tag)[node] == .struct_init_dot_comma); |
| 1389 | 1389 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1394,7 +1394,7 @@ pub fn structInitDot(tree: Tree, node: Node.Index) full.StructInit { |
| 1394 | 1394 | }); |
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | | pub fn structInit(tree: Tree, node: Node.Index) full.StructInit { |
| 1397 | pub fn structInit(tree: Ast, node: Node.Index) full.StructInit { |
| 1398 | 1398 | assert(tree.nodes.items(.tag)[node] == .struct_init or |
| 1399 | 1399 | tree.nodes.items(.tag)[node] == .struct_init_comma); |
| 1400 | 1400 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1406,7 +1406,7 @@ pub fn structInit(tree: Tree, node: Node.Index) full.StructInit { |
| 1406 | 1406 | }); |
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | | pub fn arrayInitOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.ArrayInit { |
| 1409 | pub fn arrayInitOne(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.ArrayInit { |
| 1410 | 1410 | assert(tree.nodes.items(.tag)[node] == .array_init_one or |
| 1411 | 1411 | tree.nodes.items(.tag)[node] == .array_init_one_comma); |
| 1412 | 1412 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1421,7 +1421,7 @@ pub fn arrayInitOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.A |
| 1421 | 1421 | }; |
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | | pub fn arrayInitDotTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) full.ArrayInit { |
| 1424 | pub fn arrayInitDotTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.ArrayInit { |
| 1425 | 1425 | assert(tree.nodes.items(.tag)[node] == .array_init_dot_two or |
| 1426 | 1426 | tree.nodes.items(.tag)[node] == .array_init_dot_two_comma); |
| 1427 | 1427 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1441,7 +1441,7 @@ pub fn arrayInitDotTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) ful |
| 1441 | 1441 | }; |
| 1442 | 1442 | } |
| 1443 | 1443 | |
| 1444 | | pub fn arrayInitDot(tree: Tree, node: Node.Index) full.ArrayInit { |
| 1444 | pub fn arrayInitDot(tree: Ast, node: Node.Index) full.ArrayInit { |
| 1445 | 1445 | assert(tree.nodes.items(.tag)[node] == .array_init_dot or |
| 1446 | 1446 | tree.nodes.items(.tag)[node] == .array_init_dot_comma); |
| 1447 | 1447 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1454,7 +1454,7 @@ pub fn arrayInitDot(tree: Tree, node: Node.Index) full.ArrayInit { |
| 1454 | 1454 | }; |
| 1455 | 1455 | } |
| 1456 | 1456 | |
| 1457 | | pub fn arrayInit(tree: Tree, node: Node.Index) full.ArrayInit { |
| 1457 | pub fn arrayInit(tree: Ast, node: Node.Index) full.ArrayInit { |
| 1458 | 1458 | assert(tree.nodes.items(.tag)[node] == .array_init or |
| 1459 | 1459 | tree.nodes.items(.tag)[node] == .array_init_comma); |
| 1460 | 1460 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1468,7 +1468,7 @@ pub fn arrayInit(tree: Tree, node: Node.Index) full.ArrayInit { |
| 1468 | 1468 | }; |
| 1469 | 1469 | } |
| 1470 | 1470 | |
| 1471 | | pub fn arrayType(tree: Tree, node: Node.Index) full.ArrayType { |
| 1471 | pub fn arrayType(tree: Ast, node: Node.Index) full.ArrayType { |
| 1472 | 1472 | assert(tree.nodes.items(.tag)[node] == .array_type); |
| 1473 | 1473 | const data = tree.nodes.items(.data)[node]; |
| 1474 | 1474 | return .{ |
| ... | ... | @@ -1481,7 +1481,7 @@ pub fn arrayType(tree: Tree, node: Node.Index) full.ArrayType { |
| 1481 | 1481 | }; |
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | | pub fn arrayTypeSentinel(tree: Tree, node: Node.Index) full.ArrayType { |
| 1484 | pub fn arrayTypeSentinel(tree: Ast, node: Node.Index) full.ArrayType { |
| 1485 | 1485 | assert(tree.nodes.items(.tag)[node] == .array_type_sentinel); |
| 1486 | 1486 | const data = tree.nodes.items(.data)[node]; |
| 1487 | 1487 | const extra = tree.extraData(data.rhs, Node.ArrayTypeSentinel); |
| ... | ... | @@ -1496,7 +1496,7 @@ pub fn arrayTypeSentinel(tree: Tree, node: Node.Index) full.ArrayType { |
| 1496 | 1496 | }; |
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | | pub fn ptrTypeAligned(tree: Tree, node: Node.Index) full.PtrType { |
| 1499 | pub fn ptrTypeAligned(tree: Ast, node: Node.Index) full.PtrType { |
| 1500 | 1500 | assert(tree.nodes.items(.tag)[node] == .ptr_type_aligned); |
| 1501 | 1501 | const data = tree.nodes.items(.data)[node]; |
| 1502 | 1502 | return tree.fullPtrType(.{ |
| ... | ... | @@ -1510,7 +1510,7 @@ pub fn ptrTypeAligned(tree: Tree, node: Node.Index) full.PtrType { |
| 1510 | 1510 | }); |
| 1511 | 1511 | } |
| 1512 | 1512 | |
| 1513 | | pub fn ptrTypeSentinel(tree: Tree, node: Node.Index) full.PtrType { |
| 1513 | pub fn ptrTypeSentinel(tree: Ast, node: Node.Index) full.PtrType { |
| 1514 | 1514 | assert(tree.nodes.items(.tag)[node] == .ptr_type_sentinel); |
| 1515 | 1515 | const data = tree.nodes.items(.data)[node]; |
| 1516 | 1516 | return tree.fullPtrType(.{ |
| ... | ... | @@ -1524,7 +1524,7 @@ pub fn ptrTypeSentinel(tree: Tree, node: Node.Index) full.PtrType { |
| 1524 | 1524 | }); |
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | | pub fn ptrType(tree: Tree, node: Node.Index) full.PtrType { |
| 1527 | pub fn ptrType(tree: Ast, node: Node.Index) full.PtrType { |
| 1528 | 1528 | assert(tree.nodes.items(.tag)[node] == .ptr_type); |
| 1529 | 1529 | const data = tree.nodes.items(.data)[node]; |
| 1530 | 1530 | const extra = tree.extraData(data.lhs, Node.PtrType); |
| ... | ... | @@ -1539,7 +1539,7 @@ pub fn ptrType(tree: Tree, node: Node.Index) full.PtrType { |
| 1539 | 1539 | }); |
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | | pub fn ptrTypeBitRange(tree: Tree, node: Node.Index) full.PtrType { |
| 1542 | pub fn ptrTypeBitRange(tree: Ast, node: Node.Index) full.PtrType { |
| 1543 | 1543 | assert(tree.nodes.items(.tag)[node] == .ptr_type_bit_range); |
| 1544 | 1544 | const data = tree.nodes.items(.data)[node]; |
| 1545 | 1545 | const extra = tree.extraData(data.lhs, Node.PtrTypeBitRange); |
| ... | ... | @@ -1554,7 +1554,7 @@ pub fn ptrTypeBitRange(tree: Tree, node: Node.Index) full.PtrType { |
| 1554 | 1554 | }); |
| 1555 | 1555 | } |
| 1556 | 1556 | |
| 1557 | | pub fn sliceOpen(tree: Tree, node: Node.Index) full.Slice { |
| 1557 | pub fn sliceOpen(tree: Ast, node: Node.Index) full.Slice { |
| 1558 | 1558 | assert(tree.nodes.items(.tag)[node] == .slice_open); |
| 1559 | 1559 | const data = tree.nodes.items(.data)[node]; |
| 1560 | 1560 | return .{ |
| ... | ... | @@ -1568,7 +1568,7 @@ pub fn sliceOpen(tree: Tree, node: Node.Index) full.Slice { |
| 1568 | 1568 | }; |
| 1569 | 1569 | } |
| 1570 | 1570 | |
| 1571 | | pub fn slice(tree: Tree, node: Node.Index) full.Slice { |
| 1571 | pub fn slice(tree: Ast, node: Node.Index) full.Slice { |
| 1572 | 1572 | assert(tree.nodes.items(.tag)[node] == .slice); |
| 1573 | 1573 | const data = tree.nodes.items(.data)[node]; |
| 1574 | 1574 | const extra = tree.extraData(data.rhs, Node.Slice); |
| ... | ... | @@ -1583,7 +1583,7 @@ pub fn slice(tree: Tree, node: Node.Index) full.Slice { |
| 1583 | 1583 | }; |
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | | pub fn sliceSentinel(tree: Tree, node: Node.Index) full.Slice { |
| 1586 | pub fn sliceSentinel(tree: Ast, node: Node.Index) full.Slice { |
| 1587 | 1587 | assert(tree.nodes.items(.tag)[node] == .slice_sentinel); |
| 1588 | 1588 | const data = tree.nodes.items(.data)[node]; |
| 1589 | 1589 | const extra = tree.extraData(data.rhs, Node.SliceSentinel); |
| ... | ... | @@ -1598,7 +1598,7 @@ pub fn sliceSentinel(tree: Tree, node: Node.Index) full.Slice { |
| 1598 | 1598 | }; |
| 1599 | 1599 | } |
| 1600 | 1600 | |
| 1601 | | pub fn containerDeclTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl { |
| 1601 | pub fn containerDeclTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl { |
| 1602 | 1602 | assert(tree.nodes.items(.tag)[node] == .container_decl_two or |
| 1603 | 1603 | tree.nodes.items(.tag)[node] == .container_decl_two_trailing); |
| 1604 | 1604 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1617,7 +1617,7 @@ pub fn containerDeclTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) fu |
| 1617 | 1617 | }); |
| 1618 | 1618 | } |
| 1619 | 1619 | |
| 1620 | | pub fn containerDecl(tree: Tree, node: Node.Index) full.ContainerDecl { |
| 1620 | pub fn containerDecl(tree: Ast, node: Node.Index) full.ContainerDecl { |
| 1621 | 1621 | assert(tree.nodes.items(.tag)[node] == .container_decl or |
| 1622 | 1622 | tree.nodes.items(.tag)[node] == .container_decl_trailing); |
| 1623 | 1623 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1629,7 +1629,7 @@ pub fn containerDecl(tree: Tree, node: Node.Index) full.ContainerDecl { |
| 1629 | 1629 | }); |
| 1630 | 1630 | } |
| 1631 | 1631 | |
| 1632 | | pub fn containerDeclArg(tree: Tree, node: Node.Index) full.ContainerDecl { |
| 1632 | pub fn containerDeclArg(tree: Ast, node: Node.Index) full.ContainerDecl { |
| 1633 | 1633 | assert(tree.nodes.items(.tag)[node] == .container_decl_arg or |
| 1634 | 1634 | tree.nodes.items(.tag)[node] == .container_decl_arg_trailing); |
| 1635 | 1635 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1642,7 +1642,7 @@ pub fn containerDeclArg(tree: Tree, node: Node.Index) full.ContainerDecl { |
| 1642 | 1642 | }); |
| 1643 | 1643 | } |
| 1644 | 1644 | |
| 1645 | | pub fn taggedUnionTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl { |
| 1645 | pub fn taggedUnionTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl { |
| 1646 | 1646 | assert(tree.nodes.items(.tag)[node] == .tagged_union_two or |
| 1647 | 1647 | tree.nodes.items(.tag)[node] == .tagged_union_two_trailing); |
| 1648 | 1648 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1662,7 +1662,7 @@ pub fn taggedUnionTwo(tree: Tree, buffer: *[2]Node.Index, node: Node.Index) full |
| 1662 | 1662 | }); |
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | | pub fn taggedUnion(tree: Tree, node: Node.Index) full.ContainerDecl { |
| 1665 | pub fn taggedUnion(tree: Ast, node: Node.Index) full.ContainerDecl { |
| 1666 | 1666 | assert(tree.nodes.items(.tag)[node] == .tagged_union or |
| 1667 | 1667 | tree.nodes.items(.tag)[node] == .tagged_union_trailing); |
| 1668 | 1668 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1675,7 +1675,7 @@ pub fn taggedUnion(tree: Tree, node: Node.Index) full.ContainerDecl { |
| 1675 | 1675 | }); |
| 1676 | 1676 | } |
| 1677 | 1677 | |
| 1678 | | pub fn taggedUnionEnumTag(tree: Tree, node: Node.Index) full.ContainerDecl { |
| 1678 | pub fn taggedUnionEnumTag(tree: Ast, node: Node.Index) full.ContainerDecl { |
| 1679 | 1679 | assert(tree.nodes.items(.tag)[node] == .tagged_union_enum_tag or |
| 1680 | 1680 | tree.nodes.items(.tag)[node] == .tagged_union_enum_tag_trailing); |
| 1681 | 1681 | const data = tree.nodes.items(.data)[node]; |
| ... | ... | @@ -1689,7 +1689,7 @@ pub fn taggedUnionEnumTag(tree: Tree, node: Node.Index) full.ContainerDecl { |
| 1689 | 1689 | }); |
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | | pub fn switchCaseOne(tree: Tree, node: Node.Index) full.SwitchCase { |
| 1692 | pub fn switchCaseOne(tree: Ast, node: Node.Index) full.SwitchCase { |
| 1693 | 1693 | const data = &tree.nodes.items(.data)[node]; |
| 1694 | 1694 | const values: *[1]Node.Index = &data.lhs; |
| 1695 | 1695 | return tree.fullSwitchCase(.{ |
| ... | ... | @@ -1699,7 +1699,7 @@ pub fn switchCaseOne(tree: Tree, node: Node.Index) full.SwitchCase { |
| 1699 | 1699 | }); |
| 1700 | 1700 | } |
| 1701 | 1701 | |
| 1702 | | pub fn switchCase(tree: Tree, node: Node.Index) full.SwitchCase { |
| 1702 | pub fn switchCase(tree: Ast, node: Node.Index) full.SwitchCase { |
| 1703 | 1703 | const data = tree.nodes.items(.data)[node]; |
| 1704 | 1704 | const extra = tree.extraData(data.lhs, Node.SubRange); |
| 1705 | 1705 | return tree.fullSwitchCase(.{ |
| ... | ... | @@ -1709,7 +1709,7 @@ pub fn switchCase(tree: Tree, node: Node.Index) full.SwitchCase { |
| 1709 | 1709 | }); |
| 1710 | 1710 | } |
| 1711 | 1711 | |
| 1712 | | pub fn asmSimple(tree: Tree, node: Node.Index) full.Asm { |
| 1712 | pub fn asmSimple(tree: Ast, node: Node.Index) full.Asm { |
| 1713 | 1713 | const data = tree.nodes.items(.data)[node]; |
| 1714 | 1714 | return tree.fullAsm(.{ |
| 1715 | 1715 | .asm_token = tree.nodes.items(.main_token)[node], |
| ... | ... | @@ -1719,7 +1719,7 @@ pub fn asmSimple(tree: Tree, node: Node.Index) full.Asm { |
| 1719 | 1719 | }); |
| 1720 | 1720 | } |
| 1721 | 1721 | |
| 1722 | | pub fn asmFull(tree: Tree, node: Node.Index) full.Asm { |
| 1722 | pub fn asmFull(tree: Ast, node: Node.Index) full.Asm { |
| 1723 | 1723 | const data = tree.nodes.items(.data)[node]; |
| 1724 | 1724 | const extra = tree.extraData(data.rhs, Node.Asm); |
| 1725 | 1725 | return tree.fullAsm(.{ |
| ... | ... | @@ -1730,7 +1730,7 @@ pub fn asmFull(tree: Tree, node: Node.Index) full.Asm { |
| 1730 | 1730 | }); |
| 1731 | 1731 | } |
| 1732 | 1732 | |
| 1733 | | pub fn whileSimple(tree: Tree, node: Node.Index) full.While { |
| 1733 | pub fn whileSimple(tree: Ast, node: Node.Index) full.While { |
| 1734 | 1734 | const data = tree.nodes.items(.data)[node]; |
| 1735 | 1735 | return tree.fullWhile(.{ |
| 1736 | 1736 | .while_token = tree.nodes.items(.main_token)[node], |
| ... | ... | @@ -1741,7 +1741,7 @@ pub fn whileSimple(tree: Tree, node: Node.Index) full.While { |
| 1741 | 1741 | }); |
| 1742 | 1742 | } |
| 1743 | 1743 | |
| 1744 | | pub fn whileCont(tree: Tree, node: Node.Index) full.While { |
| 1744 | pub fn whileCont(tree: Ast, node: Node.Index) full.While { |
| 1745 | 1745 | const data = tree.nodes.items(.data)[node]; |
| 1746 | 1746 | const extra = tree.extraData(data.rhs, Node.WhileCont); |
| 1747 | 1747 | return tree.fullWhile(.{ |
| ... | ... | @@ -1753,7 +1753,7 @@ pub fn whileCont(tree: Tree, node: Node.Index) full.While { |
| 1753 | 1753 | }); |
| 1754 | 1754 | } |
| 1755 | 1755 | |
| 1756 | | pub fn whileFull(tree: Tree, node: Node.Index) full.While { |
| 1756 | pub fn whileFull(tree: Ast, node: Node.Index) full.While { |
| 1757 | 1757 | const data = tree.nodes.items(.data)[node]; |
| 1758 | 1758 | const extra = tree.extraData(data.rhs, Node.While); |
| 1759 | 1759 | return tree.fullWhile(.{ |
| ... | ... | @@ -1765,7 +1765,7 @@ pub fn whileFull(tree: Tree, node: Node.Index) full.While { |
| 1765 | 1765 | }); |
| 1766 | 1766 | } |
| 1767 | 1767 | |
| 1768 | | pub fn forSimple(tree: Tree, node: Node.Index) full.While { |
| 1768 | pub fn forSimple(tree: Ast, node: Node.Index) full.While { |
| 1769 | 1769 | const data = tree.nodes.items(.data)[node]; |
| 1770 | 1770 | return tree.fullWhile(.{ |
| 1771 | 1771 | .while_token = tree.nodes.items(.main_token)[node], |
| ... | ... | @@ -1776,7 +1776,7 @@ pub fn forSimple(tree: Tree, node: Node.Index) full.While { |
| 1776 | 1776 | }); |
| 1777 | 1777 | } |
| 1778 | 1778 | |
| 1779 | | pub fn forFull(tree: Tree, node: Node.Index) full.While { |
| 1779 | pub fn forFull(tree: Ast, node: Node.Index) full.While { |
| 1780 | 1780 | const data = tree.nodes.items(.data)[node]; |
| 1781 | 1781 | const extra = tree.extraData(data.rhs, Node.If); |
| 1782 | 1782 | return tree.fullWhile(.{ |
| ... | ... | @@ -1788,7 +1788,7 @@ pub fn forFull(tree: Tree, node: Node.Index) full.While { |
| 1788 | 1788 | }); |
| 1789 | 1789 | } |
| 1790 | 1790 | |
| 1791 | | pub fn callOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.Call { |
| 1791 | pub fn callOne(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.Call { |
| 1792 | 1792 | const data = tree.nodes.items(.data)[node]; |
| 1793 | 1793 | buffer.* = .{data.rhs}; |
| 1794 | 1794 | const params = if (data.rhs != 0) buffer[0..1] else buffer[0..0]; |
| ... | ... | @@ -1799,7 +1799,7 @@ pub fn callOne(tree: Tree, buffer: *[1]Node.Index, node: Node.Index) full.Call { |
| 1799 | 1799 | }); |
| 1800 | 1800 | } |
| 1801 | 1801 | |
| 1802 | | pub fn callFull(tree: Tree, node: Node.Index) full.Call { |
| 1802 | pub fn callFull(tree: Ast, node: Node.Index) full.Call { |
| 1803 | 1803 | const data = tree.nodes.items(.data)[node]; |
| 1804 | 1804 | const extra = tree.extraData(data.rhs, Node.SubRange); |
| 1805 | 1805 | return tree.fullCall(.{ |
| ... | ... | @@ -1809,7 +1809,7 @@ pub fn callFull(tree: Tree, node: Node.Index) full.Call { |
| 1809 | 1809 | }); |
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | | fn fullVarDecl(tree: Tree, info: full.VarDecl.Components) full.VarDecl { |
| 1812 | fn fullVarDecl(tree: Ast, info: full.VarDecl.Components) full.VarDecl { |
| 1813 | 1813 | const token_tags = tree.tokens.items(.tag); |
| 1814 | 1814 | var result: full.VarDecl = .{ |
| 1815 | 1815 | .ast = info, |
| ... | ... | @@ -1834,7 +1834,7 @@ fn fullVarDecl(tree: Tree, info: full.VarDecl.Components) full.VarDecl { |
| 1834 | 1834 | return result; |
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | | fn fullIf(tree: Tree, info: full.If.Components) full.If { |
| 1837 | fn fullIf(tree: Ast, info: full.If.Components) full.If { |
| 1838 | 1838 | const token_tags = tree.tokens.items(.tag); |
| 1839 | 1839 | var result: full.If = .{ |
| 1840 | 1840 | .ast = info, |
| ... | ... | @@ -1859,7 +1859,7 @@ fn fullIf(tree: Tree, info: full.If.Components) full.If { |
| 1859 | 1859 | return result; |
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | | fn fullContainerField(tree: Tree, info: full.ContainerField.Components) full.ContainerField { |
| 1862 | fn fullContainerField(tree: Ast, info: full.ContainerField.Components) full.ContainerField { |
| 1863 | 1863 | const token_tags = tree.tokens.items(.tag); |
| 1864 | 1864 | var result: full.ContainerField = .{ |
| 1865 | 1865 | .ast = info, |
| ... | ... | @@ -1873,7 +1873,7 @@ fn fullContainerField(tree: Tree, info: full.ContainerField.Components) full.Con |
| 1873 | 1873 | return result; |
| 1874 | 1874 | } |
| 1875 | 1875 | |
| 1876 | | fn fullFnProto(tree: Tree, info: full.FnProto.Components) full.FnProto { |
| 1876 | fn fullFnProto(tree: Ast, info: full.FnProto.Components) full.FnProto { |
| 1877 | 1877 | const token_tags = tree.tokens.items(.tag); |
| 1878 | 1878 | var result: full.FnProto = .{ |
| 1879 | 1879 | .ast = info, |
| ... | ... | @@ -1909,7 +1909,7 @@ fn fullFnProto(tree: Tree, info: full.FnProto.Components) full.FnProto { |
| 1909 | 1909 | return result; |
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | | fn fullStructInit(tree: Tree, info: full.StructInit.Components) full.StructInit { |
| 1912 | fn fullStructInit(tree: Ast, info: full.StructInit.Components) full.StructInit { |
| 1913 | 1913 | _ = tree; |
| 1914 | 1914 | var result: full.StructInit = .{ |
| 1915 | 1915 | .ast = info, |
| ... | ... | @@ -1917,7 +1917,7 @@ fn fullStructInit(tree: Tree, info: full.StructInit.Components) full.StructInit |
| 1917 | 1917 | return result; |
| 1918 | 1918 | } |
| 1919 | 1919 | |
| 1920 | | fn fullPtrType(tree: Tree, info: full.PtrType.Components) full.PtrType { |
| 1920 | fn fullPtrType(tree: Ast, info: full.PtrType.Components) full.PtrType { |
| 1921 | 1921 | const token_tags = tree.tokens.items(.tag); |
| 1922 | 1922 | // TODO: looks like stage1 isn't quite smart enough to handle enum |
| 1923 | 1923 | // literals in some places here |
| ... | ... | @@ -1966,7 +1966,7 @@ fn fullPtrType(tree: Tree, info: full.PtrType.Components) full.PtrType { |
| 1966 | 1966 | return result; |
| 1967 | 1967 | } |
| 1968 | 1968 | |
| 1969 | | fn fullContainerDecl(tree: Tree, info: full.ContainerDecl.Components) full.ContainerDecl { |
| 1969 | fn fullContainerDecl(tree: Ast, info: full.ContainerDecl.Components) full.ContainerDecl { |
| 1970 | 1970 | const token_tags = tree.tokens.items(.tag); |
| 1971 | 1971 | var result: full.ContainerDecl = .{ |
| 1972 | 1972 | .ast = info, |
| ... | ... | @@ -1979,7 +1979,7 @@ fn fullContainerDecl(tree: Tree, info: full.ContainerDecl.Components) full.Conta |
| 1979 | 1979 | return result; |
| 1980 | 1980 | } |
| 1981 | 1981 | |
| 1982 | | fn fullSwitchCase(tree: Tree, info: full.SwitchCase.Components) full.SwitchCase { |
| 1982 | fn fullSwitchCase(tree: Ast, info: full.SwitchCase.Components) full.SwitchCase { |
| 1983 | 1983 | const token_tags = tree.tokens.items(.tag); |
| 1984 | 1984 | var result: full.SwitchCase = .{ |
| 1985 | 1985 | .ast = info, |
| ... | ... | @@ -1991,7 +1991,7 @@ fn fullSwitchCase(tree: Tree, info: full.SwitchCase.Components) full.SwitchCase |
| 1991 | 1991 | return result; |
| 1992 | 1992 | } |
| 1993 | 1993 | |
| 1994 | | fn fullAsm(tree: Tree, info: full.Asm.Components) full.Asm { |
| 1994 | fn fullAsm(tree: Ast, info: full.Asm.Components) full.Asm { |
| 1995 | 1995 | const token_tags = tree.tokens.items(.tag); |
| 1996 | 1996 | const node_tags = tree.nodes.items(.tag); |
| 1997 | 1997 | var result: full.Asm = .{ |
| ... | ... | @@ -2054,7 +2054,7 @@ fn fullAsm(tree: Tree, info: full.Asm.Components) full.Asm { |
| 2054 | 2054 | return result; |
| 2055 | 2055 | } |
| 2056 | 2056 | |
| 2057 | | fn fullWhile(tree: Tree, info: full.While.Components) full.While { |
| 2057 | fn fullWhile(tree: Ast, info: full.While.Components) full.While { |
| 2058 | 2058 | const token_tags = tree.tokens.items(.tag); |
| 2059 | 2059 | var result: full.While = .{ |
| 2060 | 2060 | .ast = info, |
| ... | ... | @@ -2089,7 +2089,7 @@ fn fullWhile(tree: Tree, info: full.While.Components) full.While { |
| 2089 | 2089 | return result; |
| 2090 | 2090 | } |
| 2091 | 2091 | |
| 2092 | | fn fullCall(tree: Tree, info: full.Call.Components) full.Call { |
| 2092 | fn fullCall(tree: Ast, info: full.Call.Components) full.Call { |
| 2093 | 2093 | const token_tags = tree.tokens.items(.tag); |
| 2094 | 2094 | var result: full.Call = .{ |
| 2095 | 2095 | .ast = info, |
| ... | ... | @@ -2201,7 +2201,7 @@ pub const full = struct { |
| 2201 | 2201 | /// in the params slice, since they are simple identifiers and |
| 2202 | 2202 | /// not sub-expressions. |
| 2203 | 2203 | pub const Iterator = struct { |
| 2204 | | tree: *const Tree, |
| 2204 | tree: *const Ast, |
| 2205 | 2205 | fn_proto: *const FnProto, |
| 2206 | 2206 | param_i: usize, |
| 2207 | 2207 | tok_i: TokenIndex, |
| ... | ... | @@ -2291,7 +2291,7 @@ pub const full = struct { |
| 2291 | 2291 | } |
| 2292 | 2292 | }; |
| 2293 | 2293 | |
| 2294 | | pub fn iterate(fn_proto: FnProto, tree: Tree) Iterator { |
| 2294 | pub fn iterate(fn_proto: FnProto, tree: Ast) Iterator { |
| 2295 | 2295 | return .{ |
| 2296 | 2296 | .tree = &tree, |
| 2297 | 2297 | .fn_proto = &fn_proto, |
| ... | ... | @@ -2485,7 +2485,7 @@ pub const Node = struct { |
| 2485 | 2485 | } |
| 2486 | 2486 | |
| 2487 | 2487 | /// Note: The FooComma/FooSemicolon variants exist to ease the implementation of |
| 2488 | | /// Tree.lastToken() |
| 2488 | /// Ast.lastToken() |
| 2489 | 2489 | pub const Tag = enum { |
| 2490 | 2490 | /// sub_list[lhs...rhs] |
| 2491 | 2491 | root, |