authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-01-07 17:27:58-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-01-12 11:56:45-07:00
log73cbc13a971f6b3624350579e40638ca9ce696a1
tree63ee59d8f791d25f2e2c5a1bc9c8aae33857f60a
parentadf7c654d41d9d467b40d81f91667a12bf98240f

std: fix zig.Ast being called Tree internally


1 files changed, 74 insertions(+), 74 deletions(-)

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