| ... | @@ -17,7 +17,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -17,7 +17,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 17 | defer stack.deinit(); | 17 | defer stack.deinit(); |
| 18 | | 18 | |
| 19 | const arena = &tree_arena.allocator; | 19 | const arena = &tree_arena.allocator; |
| 20 | const root_node = try arena.construct(ast.Node.Root{ | 20 | const root_node = try arena.create(ast.Node.Root{ |
| 21 | .base = ast.Node{ .id = ast.Node.Id.Root }, | 21 | .base = ast.Node{ .id = ast.Node.Id.Root }, |
| 22 | .decls = ast.Node.Root.DeclList.init(arena), | 22 | .decls = ast.Node.Root.DeclList.init(arena), |
| 23 | .doc_comments = null, | 23 | .doc_comments = null, |
| ... | @@ -65,14 +65,14 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -65,14 +65,14 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 65 | Token.Id.Keyword_test => { | 65 | Token.Id.Keyword_test => { |
| 66 | stack.append(State.TopLevel) catch unreachable; | 66 | stack.append(State.TopLevel) catch unreachable; |
| 67 | | 67 | |
| 68 | const block = try arena.construct(ast.Node.Block{ | 68 | const block = try arena.create(ast.Node.Block{ |
| 69 | .base = ast.Node{ .id = ast.Node.Id.Block }, | 69 | .base = ast.Node{ .id = ast.Node.Id.Block }, |
| 70 | .label = null, | 70 | .label = null, |
| 71 | .lbrace = undefined, | 71 | .lbrace = undefined, |
| 72 | .statements = ast.Node.Block.StatementList.init(arena), | 72 | .statements = ast.Node.Block.StatementList.init(arena), |
| 73 | .rbrace = undefined, | 73 | .rbrace = undefined, |
| 74 | }); | 74 | }); |
| 75 | const test_node = try arena.construct(ast.Node.TestDecl{ | 75 | const test_node = try arena.create(ast.Node.TestDecl{ |
| 76 | .base = ast.Node{ .id = ast.Node.Id.TestDecl }, | 76 | .base = ast.Node{ .id = ast.Node.Id.TestDecl }, |
| 77 | .doc_comments = comments, | 77 | .doc_comments = comments, |
| 78 | .test_token = token_index, | 78 | .test_token = token_index, |
| ... | @@ -109,14 +109,14 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -109,14 +109,14 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 109 | continue; | 109 | continue; |
| 110 | }, | 110 | }, |
| 111 | Token.Id.Keyword_comptime => { | 111 | Token.Id.Keyword_comptime => { |
| 112 | const block = try arena.construct(ast.Node.Block{ | 112 | const block = try arena.create(ast.Node.Block{ |
| 113 | .base = ast.Node{ .id = ast.Node.Id.Block }, | 113 | .base = ast.Node{ .id = ast.Node.Id.Block }, |
| 114 | .label = null, | 114 | .label = null, |
| 115 | .lbrace = undefined, | 115 | .lbrace = undefined, |
| 116 | .statements = ast.Node.Block.StatementList.init(arena), | 116 | .statements = ast.Node.Block.StatementList.init(arena), |
| 117 | .rbrace = undefined, | 117 | .rbrace = undefined, |
| 118 | }); | 118 | }); |
| 119 | const node = try arena.construct(ast.Node.Comptime{ | 119 | const node = try arena.create(ast.Node.Comptime{ |
| 120 | .base = ast.Node{ .id = ast.Node.Id.Comptime }, | 120 | .base = ast.Node{ .id = ast.Node.Id.Comptime }, |
| 121 | .comptime_token = token_index, | 121 | .comptime_token = token_index, |
| 122 | .expr = &block.base, | 122 | .expr = &block.base, |
| ... | @@ -225,7 +225,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -225,7 +225,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 225 | return tree; | 225 | return tree; |
| 226 | } | 226 | } |
| 227 | | 227 | |
| 228 | const node = try arena.construct(ast.Node.Use{ | 228 | const node = try arena.create(ast.Node.Use{ |
| 229 | .base = ast.Node{ .id = ast.Node.Id.Use }, | 229 | .base = ast.Node{ .id = ast.Node.Id.Use }, |
| 230 | .use_token = token_index, | 230 | .use_token = token_index, |
| 231 | .visib_token = ctx.visib_token, | 231 | .visib_token = ctx.visib_token, |
| ... | @@ -266,7 +266,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -266,7 +266,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 266 | continue; | 266 | continue; |
| 267 | }, | 267 | }, |
| 268 | Token.Id.Keyword_fn, Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc, Token.Id.Keyword_async => { | 268 | Token.Id.Keyword_fn, Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc, Token.Id.Keyword_async => { |
| 269 | const fn_proto = try arena.construct(ast.Node.FnProto{ | 269 | const fn_proto = try arena.create(ast.Node.FnProto{ |
| 270 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, | 270 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, |
| 271 | .doc_comments = ctx.comments, | 271 | .doc_comments = ctx.comments, |
| 272 | .visib_token = ctx.visib_token, | 272 | .visib_token = ctx.visib_token, |
| ... | @@ -298,7 +298,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -298,7 +298,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 298 | continue; | 298 | continue; |
| 299 | }, | 299 | }, |
| 300 | Token.Id.Keyword_async => { | 300 | Token.Id.Keyword_async => { |
| 301 | const async_node = try arena.construct(ast.Node.AsyncAttribute{ | 301 | const async_node = try arena.create(ast.Node.AsyncAttribute{ |
| 302 | .base = ast.Node{ .id = ast.Node.Id.AsyncAttribute }, | 302 | .base = ast.Node{ .id = ast.Node.Id.AsyncAttribute }, |
| 303 | .async_token = token_index, | 303 | .async_token = token_index, |
| 304 | .allocator_type = null, | 304 | .allocator_type = null, |
| ... | @@ -330,7 +330,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -330,7 +330,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 330 | }, | 330 | }, |
| 331 | State.TopLevelExternOrField => |ctx| { | 331 | State.TopLevelExternOrField => |ctx| { |
| 332 | if (eatToken(&tok_it, &tree, Token.Id.Identifier)) |identifier| { | 332 | if (eatToken(&tok_it, &tree, Token.Id.Identifier)) |identifier| { |
| 333 | const node = try arena.construct(ast.Node.StructField{ | 333 | const node = try arena.create(ast.Node.StructField{ |
| 334 | .base = ast.Node{ .id = ast.Node.Id.StructField }, | 334 | .base = ast.Node{ .id = ast.Node.Id.StructField }, |
| 335 | .doc_comments = ctx.comments, | 335 | .doc_comments = ctx.comments, |
| 336 | .visib_token = ctx.visib_token, | 336 | .visib_token = ctx.visib_token, |
| ... | @@ -375,7 +375,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -375,7 +375,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 375 | const token = nextToken(&tok_it, &tree); | 375 | const token = nextToken(&tok_it, &tree); |
| 376 | const token_index = token.index; | 376 | const token_index = token.index; |
| 377 | const token_ptr = token.ptr; | 377 | const token_ptr = token.ptr; |
| 378 | const node = try arena.construct(ast.Node.ContainerDecl{ | 378 | const node = try arena.create(ast.Node.ContainerDecl{ |
| 379 | .base = ast.Node{ .id = ast.Node.Id.ContainerDecl }, | 379 | .base = ast.Node{ .id = ast.Node.Id.ContainerDecl }, |
| 380 | .layout_token = ctx.layout_token, | 380 | .layout_token = ctx.layout_token, |
| 381 | .kind_token = switch (token_ptr.id) { | 381 | .kind_token = switch (token_ptr.id) { |
| ... | @@ -448,7 +448,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -448,7 +448,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 448 | Token.Id.Identifier => { | 448 | Token.Id.Identifier => { |
| 449 | switch (tree.tokens.at(container_decl.kind_token).id) { | 449 | switch (tree.tokens.at(container_decl.kind_token).id) { |
| 450 | Token.Id.Keyword_struct => { | 450 | Token.Id.Keyword_struct => { |
| 451 | const node = try arena.construct(ast.Node.StructField{ | 451 | const node = try arena.create(ast.Node.StructField{ |
| 452 | .base = ast.Node{ .id = ast.Node.Id.StructField }, | 452 | .base = ast.Node{ .id = ast.Node.Id.StructField }, |
| 453 | .doc_comments = comments, | 453 | .doc_comments = comments, |
| 454 | .visib_token = null, | 454 | .visib_token = null, |
| ... | @@ -464,7 +464,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -464,7 +464,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 464 | continue; | 464 | continue; |
| 465 | }, | 465 | }, |
| 466 | Token.Id.Keyword_union => { | 466 | Token.Id.Keyword_union => { |
| 467 | const node = try arena.construct(ast.Node.UnionTag{ | 467 | const node = try arena.create(ast.Node.UnionTag{ |
| 468 | .base = ast.Node{ .id = ast.Node.Id.UnionTag }, | 468 | .base = ast.Node{ .id = ast.Node.Id.UnionTag }, |
| 469 | .name_token = token_index, | 469 | .name_token = token_index, |
| 470 | .type_expr = null, | 470 | .type_expr = null, |
| ... | @@ -480,7 +480,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -480,7 +480,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 480 | continue; | 480 | continue; |
| 481 | }, | 481 | }, |
| 482 | Token.Id.Keyword_enum => { | 482 | Token.Id.Keyword_enum => { |
| 483 | const node = try arena.construct(ast.Node.EnumTag{ | 483 | const node = try arena.create(ast.Node.EnumTag{ |
| 484 | .base = ast.Node{ .id = ast.Node.Id.EnumTag }, | 484 | .base = ast.Node{ .id = ast.Node.Id.EnumTag }, |
| 485 | .name_token = token_index, | 485 | .name_token = token_index, |
| 486 | .value = null, | 486 | .value = null, |
| ... | @@ -562,7 +562,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -562,7 +562,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 562 | }, | 562 | }, |
| 563 | | 563 | |
| 564 | State.VarDecl => |ctx| { | 564 | State.VarDecl => |ctx| { |
| 565 | const var_decl = try arena.construct(ast.Node.VarDecl{ | 565 | const var_decl = try arena.create(ast.Node.VarDecl{ |
| 566 | .base = ast.Node{ .id = ast.Node.Id.VarDecl }, | 566 | .base = ast.Node{ .id = ast.Node.Id.VarDecl }, |
| 567 | .doc_comments = ctx.comments, | 567 | .doc_comments = ctx.comments, |
| 568 | .visib_token = ctx.visib_token, | 568 | .visib_token = ctx.visib_token, |
| ... | @@ -660,7 +660,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -660,7 +660,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 660 | const token_ptr = token.ptr; | 660 | const token_ptr = token.ptr; |
| 661 | switch (token_ptr.id) { | 661 | switch (token_ptr.id) { |
| 662 | Token.Id.LBrace => { | 662 | Token.Id.LBrace => { |
| 663 | const block = try arena.construct(ast.Node.Block{ | 663 | const block = try arena.create(ast.Node.Block{ |
| 664 | .base = ast.Node{ .id = ast.Node.Id.Block }, | 664 | .base = ast.Node{ .id = ast.Node.Id.Block }, |
| 665 | .label = null, | 665 | .label = null, |
| 666 | .lbrace = token_index, | 666 | .lbrace = token_index, |
| ... | @@ -712,7 +712,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -712,7 +712,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 712 | // TODO: this is a special case. Remove this when #760 is fixed | 712 | // TODO: this is a special case. Remove this when #760 is fixed |
| 713 | if (token_ptr.id == Token.Id.Keyword_error) { | 713 | if (token_ptr.id == Token.Id.Keyword_error) { |
| 714 | if (tok_it.peek().?.id == Token.Id.LBrace) { | 714 | if (tok_it.peek().?.id == Token.Id.LBrace) { |
| 715 | const error_type_node = try arena.construct(ast.Node.ErrorType{ | 715 | const error_type_node = try arena.create(ast.Node.ErrorType{ |
| 716 | .base = ast.Node{ .id = ast.Node.Id.ErrorType }, | 716 | .base = ast.Node{ .id = ast.Node.Id.ErrorType }, |
| 717 | .token = token_index, | 717 | .token = token_index, |
| 718 | }); | 718 | }); |
| ... | @@ -733,7 +733,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -733,7 +733,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 733 | if (eatToken(&tok_it, &tree, Token.Id.RParen)) |_| { | 733 | if (eatToken(&tok_it, &tree, Token.Id.RParen)) |_| { |
| 734 | continue; | 734 | continue; |
| 735 | } | 735 | } |
| 736 | const param_decl = try arena.construct(ast.Node.ParamDecl{ | 736 | const param_decl = try arena.create(ast.Node.ParamDecl{ |
| 737 | .base = ast.Node{ .id = ast.Node.Id.ParamDecl }, | 737 | .base = ast.Node{ .id = ast.Node.Id.ParamDecl }, |
| 738 | .comptime_token = null, | 738 | .comptime_token = null, |
| 739 | .noalias_token = null, | 739 | .noalias_token = null, |
| ... | @@ -819,7 +819,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -819,7 +819,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 819 | const token_ptr = token.ptr; | 819 | const token_ptr = token.ptr; |
| 820 | switch (token_ptr.id) { | 820 | switch (token_ptr.id) { |
| 821 | Token.Id.LBrace => { | 821 | Token.Id.LBrace => { |
| 822 | const block = try arena.construct(ast.Node.Block{ | 822 | const block = try arena.create(ast.Node.Block{ |
| 823 | .base = ast.Node{ .id = ast.Node.Id.Block }, | 823 | .base = ast.Node{ .id = ast.Node.Id.Block }, |
| 824 | .label = ctx.label, | 824 | .label = ctx.label, |
| 825 | .lbrace = token_index, | 825 | .lbrace = token_index, |
| ... | @@ -853,7 +853,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -853,7 +853,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 853 | continue; | 853 | continue; |
| 854 | }, | 854 | }, |
| 855 | Token.Id.Keyword_suspend => { | 855 | Token.Id.Keyword_suspend => { |
| 856 | const node = try arena.construct(ast.Node.Suspend{ | 856 | const node = try arena.create(ast.Node.Suspend{ |
| 857 | .base = ast.Node{ .id = ast.Node.Id.Suspend }, | 857 | .base = ast.Node{ .id = ast.Node.Id.Suspend }, |
| 858 | .label = ctx.label, | 858 | .label = ctx.label, |
| 859 | .suspend_token = token_index, | 859 | .suspend_token = token_index, |
| ... | @@ -925,7 +925,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -925,7 +925,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 925 | } | 925 | } |
| 926 | }, | 926 | }, |
| 927 | State.While => |ctx| { | 927 | State.While => |ctx| { |
| 928 | const node = try arena.construct(ast.Node.While{ | 928 | const node = try arena.create(ast.Node.While{ |
| 929 | .base = ast.Node{ .id = ast.Node.Id.While }, | 929 | .base = ast.Node{ .id = ast.Node.Id.While }, |
| 930 | .label = ctx.label, | 930 | .label = ctx.label, |
| 931 | .inline_token = ctx.inline_token, | 931 | .inline_token = ctx.inline_token, |
| ... | @@ -954,7 +954,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -954,7 +954,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 954 | continue; | 954 | continue; |
| 955 | }, | 955 | }, |
| 956 | State.For => |ctx| { | 956 | State.For => |ctx| { |
| 957 | const node = try arena.construct(ast.Node.For{ | 957 | const node = try arena.create(ast.Node.For{ |
| 958 | .base = ast.Node{ .id = ast.Node.Id.For }, | 958 | .base = ast.Node{ .id = ast.Node.Id.For }, |
| 959 | .label = ctx.label, | 959 | .label = ctx.label, |
| 960 | .inline_token = ctx.inline_token, | 960 | .inline_token = ctx.inline_token, |
| ... | @@ -975,7 +975,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -975,7 +975,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 975 | }, | 975 | }, |
| 976 | State.Else => |dest| { | 976 | State.Else => |dest| { |
| 977 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_else)) |else_token| { | 977 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_else)) |else_token| { |
| 978 | const node = try arena.construct(ast.Node.Else{ | 978 | const node = try arena.create(ast.Node.Else{ |
| 979 | .base = ast.Node{ .id = ast.Node.Id.Else }, | 979 | .base = ast.Node{ .id = ast.Node.Id.Else }, |
| 980 | .else_token = else_token, | 980 | .else_token = else_token, |
| 981 | .payload = null, | 981 | .payload = null, |
| ... | @@ -1038,7 +1038,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1038,7 +1038,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1038 | continue; | 1038 | continue; |
| 1039 | }, | 1039 | }, |
| 1040 | Token.Id.Keyword_defer, Token.Id.Keyword_errdefer => { | 1040 | Token.Id.Keyword_defer, Token.Id.Keyword_errdefer => { |
| 1041 | const node = try arena.construct(ast.Node.Defer{ | 1041 | const node = try arena.create(ast.Node.Defer{ |
| 1042 | .base = ast.Node{ .id = ast.Node.Id.Defer }, | 1042 | .base = ast.Node{ .id = ast.Node.Id.Defer }, |
| 1043 | .defer_token = token_index, | 1043 | .defer_token = token_index, |
| 1044 | .kind = switch (token_ptr.id) { | 1044 | .kind = switch (token_ptr.id) { |
| ... | @@ -1056,7 +1056,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1056,7 +1056,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1056 | continue; | 1056 | continue; |
| 1057 | }, | 1057 | }, |
| 1058 | Token.Id.LBrace => { | 1058 | Token.Id.LBrace => { |
| 1059 | const inner_block = try arena.construct(ast.Node.Block{ | 1059 | const inner_block = try arena.create(ast.Node.Block{ |
| 1060 | .base = ast.Node{ .id = ast.Node.Id.Block }, | 1060 | .base = ast.Node{ .id = ast.Node.Id.Block }, |
| 1061 | .label = null, | 1061 | .label = null, |
| 1062 | .lbrace = token_index, | 1062 | .lbrace = token_index, |
| ... | @@ -1124,7 +1124,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1124,7 +1124,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1124 | continue; | 1124 | continue; |
| 1125 | } | 1125 | } |
| 1126 | | 1126 | |
| 1127 | const node = try arena.construct(ast.Node.AsmOutput{ | 1127 | const node = try arena.create(ast.Node.AsmOutput{ |
| 1128 | .base = ast.Node{ .id = ast.Node.Id.AsmOutput }, | 1128 | .base = ast.Node{ .id = ast.Node.Id.AsmOutput }, |
| 1129 | .lbracket = lbracket_index, | 1129 | .lbracket = lbracket_index, |
| 1130 | .symbolic_name = undefined, | 1130 | .symbolic_name = undefined, |
| ... | @@ -1178,7 +1178,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1178,7 +1178,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1178 | continue; | 1178 | continue; |
| 1179 | } | 1179 | } |
| 1180 | | 1180 | |
| 1181 | const node = try arena.construct(ast.Node.AsmInput{ | 1181 | const node = try arena.create(ast.Node.AsmInput{ |
| 1182 | .base = ast.Node{ .id = ast.Node.Id.AsmInput }, | 1182 | .base = ast.Node{ .id = ast.Node.Id.AsmInput }, |
| 1183 | .lbracket = lbracket_index, | 1183 | .lbracket = lbracket_index, |
| 1184 | .symbolic_name = undefined, | 1184 | .symbolic_name = undefined, |
| ... | @@ -1243,7 +1243,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1243,7 +1243,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1243 | continue; | 1243 | continue; |
| 1244 | } | 1244 | } |
| 1245 | | 1245 | |
| 1246 | const node = try arena.construct(ast.Node.FieldInitializer{ | 1246 | const node = try arena.create(ast.Node.FieldInitializer{ |
| 1247 | .base = ast.Node{ .id = ast.Node.Id.FieldInitializer }, | 1247 | .base = ast.Node{ .id = ast.Node.Id.FieldInitializer }, |
| 1248 | .period_token = undefined, | 1248 | .period_token = undefined, |
| 1249 | .name_token = undefined, | 1249 | .name_token = undefined, |
| ... | @@ -1332,7 +1332,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1332,7 +1332,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1332 | } | 1332 | } |
| 1333 | | 1333 | |
| 1334 | const comments = try eatDocComments(arena, &tok_it, &tree); | 1334 | const comments = try eatDocComments(arena, &tok_it, &tree); |
| 1335 | const node = try arena.construct(ast.Node.SwitchCase{ | 1335 | const node = try arena.create(ast.Node.SwitchCase{ |
| 1336 | .base = ast.Node{ .id = ast.Node.Id.SwitchCase }, | 1336 | .base = ast.Node{ .id = ast.Node.Id.SwitchCase }, |
| 1337 | .items = ast.Node.SwitchCase.ItemList.init(arena), | 1337 | .items = ast.Node.SwitchCase.ItemList.init(arena), |
| 1338 | .payload = null, | 1338 | .payload = null, |
| ... | @@ -1369,7 +1369,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1369,7 +1369,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1369 | const token_index = token.index; | 1369 | const token_index = token.index; |
| 1370 | const token_ptr = token.ptr; | 1370 | const token_ptr = token.ptr; |
| 1371 | if (token_ptr.id == Token.Id.Keyword_else) { | 1371 | if (token_ptr.id == Token.Id.Keyword_else) { |
| 1372 | const else_node = try arena.construct(ast.Node.SwitchElse{ | 1372 | const else_node = try arena.create(ast.Node.SwitchElse{ |
| 1373 | .base = ast.Node{ .id = ast.Node.Id.SwitchElse }, | 1373 | .base = ast.Node{ .id = ast.Node.Id.SwitchElse }, |
| 1374 | .token = token_index, | 1374 | .token = token_index, |
| 1375 | }); | 1375 | }); |
| ... | @@ -1468,7 +1468,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1468,7 +1468,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1468 | | 1468 | |
| 1469 | State.ExternType => |ctx| { | 1469 | State.ExternType => |ctx| { |
| 1470 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_fn)) |fn_token| { | 1470 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_fn)) |fn_token| { |
| 1471 | const fn_proto = try arena.construct(ast.Node.FnProto{ | 1471 | const fn_proto = try arena.create(ast.Node.FnProto{ |
| 1472 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, | 1472 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, |
| 1473 | .doc_comments = ctx.comments, | 1473 | .doc_comments = ctx.comments, |
| 1474 | .visib_token = null, | 1474 | .visib_token = null, |
| ... | @@ -1641,7 +1641,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1641,7 +1641,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1641 | continue; | 1641 | continue; |
| 1642 | } | 1642 | } |
| 1643 | | 1643 | |
| 1644 | const node = try arena.construct(ast.Node.Payload{ | 1644 | const node = try arena.create(ast.Node.Payload{ |
| 1645 | .base = ast.Node{ .id = ast.Node.Id.Payload }, | 1645 | .base = ast.Node{ .id = ast.Node.Id.Payload }, |
| 1646 | .lpipe = token_index, | 1646 | .lpipe = token_index, |
| 1647 | .error_symbol = undefined, | 1647 | .error_symbol = undefined, |
| ... | @@ -1677,7 +1677,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1677,7 +1677,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1677 | continue; | 1677 | continue; |
| 1678 | } | 1678 | } |
| 1679 | | 1679 | |
| 1680 | const node = try arena.construct(ast.Node.PointerPayload{ | 1680 | const node = try arena.create(ast.Node.PointerPayload{ |
| 1681 | .base = ast.Node{ .id = ast.Node.Id.PointerPayload }, | 1681 | .base = ast.Node{ .id = ast.Node.Id.PointerPayload }, |
| 1682 | .lpipe = token_index, | 1682 | .lpipe = token_index, |
| 1683 | .ptr_token = null, | 1683 | .ptr_token = null, |
| ... | @@ -1720,7 +1720,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1720,7 +1720,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1720 | continue; | 1720 | continue; |
| 1721 | } | 1721 | } |
| 1722 | | 1722 | |
| 1723 | const node = try arena.construct(ast.Node.PointerIndexPayload{ | 1723 | const node = try arena.create(ast.Node.PointerIndexPayload{ |
| 1724 | .base = ast.Node{ .id = ast.Node.Id.PointerIndexPayload }, | 1724 | .base = ast.Node{ .id = ast.Node.Id.PointerIndexPayload }, |
| 1725 | .lpipe = token_index, | 1725 | .lpipe = token_index, |
| 1726 | .ptr_token = null, | 1726 | .ptr_token = null, |
| ... | @@ -1754,7 +1754,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1754,7 +1754,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1754 | const token_ptr = token.ptr; | 1754 | const token_ptr = token.ptr; |
| 1755 | switch (token_ptr.id) { | 1755 | switch (token_ptr.id) { |
| 1756 | Token.Id.Keyword_return, Token.Id.Keyword_break, Token.Id.Keyword_continue => { | 1756 | Token.Id.Keyword_return, Token.Id.Keyword_break, Token.Id.Keyword_continue => { |
| 1757 | const node = try arena.construct(ast.Node.ControlFlowExpression{ | 1757 | const node = try arena.create(ast.Node.ControlFlowExpression{ |
| 1758 | .base = ast.Node{ .id = ast.Node.Id.ControlFlowExpression }, | 1758 | .base = ast.Node{ .id = ast.Node.Id.ControlFlowExpression }, |
| 1759 | .ltoken = token_index, | 1759 | .ltoken = token_index, |
| 1760 | .kind = undefined, | 1760 | .kind = undefined, |
| ... | @@ -1783,7 +1783,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1783,7 +1783,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1783 | continue; | 1783 | continue; |
| 1784 | }, | 1784 | }, |
| 1785 | Token.Id.Keyword_try, Token.Id.Keyword_cancel, Token.Id.Keyword_resume => { | 1785 | Token.Id.Keyword_try, Token.Id.Keyword_cancel, Token.Id.Keyword_resume => { |
| 1786 | const node = try arena.construct(ast.Node.PrefixOp{ | 1786 | const node = try arena.create(ast.Node.PrefixOp{ |
| 1787 | .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, | 1787 | .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, |
| 1788 | .op_token = token_index, | 1788 | .op_token = token_index, |
| 1789 | .op = switch (token_ptr.id) { | 1789 | .op = switch (token_ptr.id) { |
| ... | @@ -1817,7 +1817,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1817,7 +1817,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1817 | const lhs = opt_ctx.get() orelse continue; | 1817 | const lhs = opt_ctx.get() orelse continue; |
| 1818 | | 1818 | |
| 1819 | if (eatToken(&tok_it, &tree, Token.Id.Ellipsis3)) |ellipsis3| { | 1819 | if (eatToken(&tok_it, &tree, Token.Id.Ellipsis3)) |ellipsis3| { |
| 1820 | const node = try arena.construct(ast.Node.InfixOp{ | 1820 | const node = try arena.create(ast.Node.InfixOp{ |
| 1821 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 1821 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 1822 | .lhs = lhs, | 1822 | .lhs = lhs, |
| 1823 | .op_token = ellipsis3, | 1823 | .op_token = ellipsis3, |
| ... | @@ -1842,7 +1842,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1842,7 +1842,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1842 | const token_index = token.index; | 1842 | const token_index = token.index; |
| 1843 | const token_ptr = token.ptr; | 1843 | const token_ptr = token.ptr; |
| 1844 | if (tokenIdToAssignment(token_ptr.id)) |ass_id| { | 1844 | if (tokenIdToAssignment(token_ptr.id)) |ass_id| { |
| 1845 | const node = try arena.construct(ast.Node.InfixOp{ | 1845 | const node = try arena.create(ast.Node.InfixOp{ |
| 1846 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 1846 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 1847 | .lhs = lhs, | 1847 | .lhs = lhs, |
| 1848 | .op_token = token_index, | 1848 | .op_token = token_index, |
| ... | @@ -1872,7 +1872,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1872,7 +1872,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1872 | const token_index = token.index; | 1872 | const token_index = token.index; |
| 1873 | const token_ptr = token.ptr; | 1873 | const token_ptr = token.ptr; |
| 1874 | if (tokenIdToUnwrapExpr(token_ptr.id)) |unwrap_id| { | 1874 | if (tokenIdToUnwrapExpr(token_ptr.id)) |unwrap_id| { |
| 1875 | const node = try arena.construct(ast.Node.InfixOp{ | 1875 | const node = try arena.create(ast.Node.InfixOp{ |
| 1876 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 1876 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 1877 | .lhs = lhs, | 1877 | .lhs = lhs, |
| 1878 | .op_token = token_index, | 1878 | .op_token = token_index, |
| ... | @@ -1904,7 +1904,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1904,7 +1904,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1904 | const lhs = opt_ctx.get() orelse continue; | 1904 | const lhs = opt_ctx.get() orelse continue; |
| 1905 | | 1905 | |
| 1906 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_or)) |or_token| { | 1906 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_or)) |or_token| { |
| 1907 | const node = try arena.construct(ast.Node.InfixOp{ | 1907 | const node = try arena.create(ast.Node.InfixOp{ |
| 1908 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 1908 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 1909 | .lhs = lhs, | 1909 | .lhs = lhs, |
| 1910 | .op_token = or_token, | 1910 | .op_token = or_token, |
| ... | @@ -1928,7 +1928,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1928,7 +1928,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1928 | const lhs = opt_ctx.get() orelse continue; | 1928 | const lhs = opt_ctx.get() orelse continue; |
| 1929 | | 1929 | |
| 1930 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_and)) |and_token| { | 1930 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_and)) |and_token| { |
| 1931 | const node = try arena.construct(ast.Node.InfixOp{ | 1931 | const node = try arena.create(ast.Node.InfixOp{ |
| 1932 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 1932 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 1933 | .lhs = lhs, | 1933 | .lhs = lhs, |
| 1934 | .op_token = and_token, | 1934 | .op_token = and_token, |
| ... | @@ -1955,7 +1955,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1955,7 +1955,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1955 | const token_index = token.index; | 1955 | const token_index = token.index; |
| 1956 | const token_ptr = token.ptr; | 1956 | const token_ptr = token.ptr; |
| 1957 | if (tokenIdToComparison(token_ptr.id)) |comp_id| { | 1957 | if (tokenIdToComparison(token_ptr.id)) |comp_id| { |
| 1958 | const node = try arena.construct(ast.Node.InfixOp{ | 1958 | const node = try arena.create(ast.Node.InfixOp{ |
| 1959 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 1959 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 1960 | .lhs = lhs, | 1960 | .lhs = lhs, |
| 1961 | .op_token = token_index, | 1961 | .op_token = token_index, |
| ... | @@ -1982,7 +1982,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -1982,7 +1982,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 1982 | const lhs = opt_ctx.get() orelse continue; | 1982 | const lhs = opt_ctx.get() orelse continue; |
| 1983 | | 1983 | |
| 1984 | if (eatToken(&tok_it, &tree, Token.Id.Pipe)) |pipe| { | 1984 | if (eatToken(&tok_it, &tree, Token.Id.Pipe)) |pipe| { |
| 1985 | const node = try arena.construct(ast.Node.InfixOp{ | 1985 | const node = try arena.create(ast.Node.InfixOp{ |
| 1986 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 1986 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 1987 | .lhs = lhs, | 1987 | .lhs = lhs, |
| 1988 | .op_token = pipe, | 1988 | .op_token = pipe, |
| ... | @@ -2006,7 +2006,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2006,7 +2006,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2006 | const lhs = opt_ctx.get() orelse continue; | 2006 | const lhs = opt_ctx.get() orelse continue; |
| 2007 | | 2007 | |
| 2008 | if (eatToken(&tok_it, &tree, Token.Id.Caret)) |caret| { | 2008 | if (eatToken(&tok_it, &tree, Token.Id.Caret)) |caret| { |
| 2009 | const node = try arena.construct(ast.Node.InfixOp{ | 2009 | const node = try arena.create(ast.Node.InfixOp{ |
| 2010 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 2010 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 2011 | .lhs = lhs, | 2011 | .lhs = lhs, |
| 2012 | .op_token = caret, | 2012 | .op_token = caret, |
| ... | @@ -2030,7 +2030,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2030,7 +2030,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2030 | const lhs = opt_ctx.get() orelse continue; | 2030 | const lhs = opt_ctx.get() orelse continue; |
| 2031 | | 2031 | |
| 2032 | if (eatToken(&tok_it, &tree, Token.Id.Ampersand)) |ampersand| { | 2032 | if (eatToken(&tok_it, &tree, Token.Id.Ampersand)) |ampersand| { |
| 2033 | const node = try arena.construct(ast.Node.InfixOp{ | 2033 | const node = try arena.create(ast.Node.InfixOp{ |
| 2034 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 2034 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 2035 | .lhs = lhs, | 2035 | .lhs = lhs, |
| 2036 | .op_token = ampersand, | 2036 | .op_token = ampersand, |
| ... | @@ -2057,7 +2057,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2057,7 +2057,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2057 | const token_index = token.index; | 2057 | const token_index = token.index; |
| 2058 | const token_ptr = token.ptr; | 2058 | const token_ptr = token.ptr; |
| 2059 | if (tokenIdToBitShift(token_ptr.id)) |bitshift_id| { | 2059 | if (tokenIdToBitShift(token_ptr.id)) |bitshift_id| { |
| 2060 | const node = try arena.construct(ast.Node.InfixOp{ | 2060 | const node = try arena.create(ast.Node.InfixOp{ |
| 2061 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 2061 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 2062 | .lhs = lhs, | 2062 | .lhs = lhs, |
| 2063 | .op_token = token_index, | 2063 | .op_token = token_index, |
| ... | @@ -2087,7 +2087,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2087,7 +2087,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2087 | const token_index = token.index; | 2087 | const token_index = token.index; |
| 2088 | const token_ptr = token.ptr; | 2088 | const token_ptr = token.ptr; |
| 2089 | if (tokenIdToAddition(token_ptr.id)) |add_id| { | 2089 | if (tokenIdToAddition(token_ptr.id)) |add_id| { |
| 2090 | const node = try arena.construct(ast.Node.InfixOp{ | 2090 | const node = try arena.create(ast.Node.InfixOp{ |
| 2091 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 2091 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 2092 | .lhs = lhs, | 2092 | .lhs = lhs, |
| 2093 | .op_token = token_index, | 2093 | .op_token = token_index, |
| ... | @@ -2117,7 +2117,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2117,7 +2117,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2117 | const token_index = token.index; | 2117 | const token_index = token.index; |
| 2118 | const token_ptr = token.ptr; | 2118 | const token_ptr = token.ptr; |
| 2119 | if (tokenIdToMultiply(token_ptr.id)) |mult_id| { | 2119 | if (tokenIdToMultiply(token_ptr.id)) |mult_id| { |
| 2120 | const node = try arena.construct(ast.Node.InfixOp{ | 2120 | const node = try arena.create(ast.Node.InfixOp{ |
| 2121 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 2121 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 2122 | .lhs = lhs, | 2122 | .lhs = lhs, |
| 2123 | .op_token = token_index, | 2123 | .op_token = token_index, |
| ... | @@ -2145,7 +2145,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2145,7 +2145,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2145 | const lhs = opt_ctx.get() orelse continue; | 2145 | const lhs = opt_ctx.get() orelse continue; |
| 2146 | | 2146 | |
| 2147 | if (tok_it.peek().?.id == Token.Id.Period) { | 2147 | if (tok_it.peek().?.id == Token.Id.Period) { |
| 2148 | const node = try arena.construct(ast.Node.SuffixOp{ | 2148 | const node = try arena.create(ast.Node.SuffixOp{ |
| 2149 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, | 2149 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, |
| 2150 | .lhs = lhs, | 2150 | .lhs = lhs, |
| 2151 | .op = ast.Node.SuffixOp.Op{ .StructInitializer = ast.Node.SuffixOp.Op.InitList.init(arena) }, | 2151 | .op = ast.Node.SuffixOp.Op{ .StructInitializer = ast.Node.SuffixOp.Op.InitList.init(arena) }, |
| ... | @@ -2164,7 +2164,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2164,7 +2164,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2164 | continue; | 2164 | continue; |
| 2165 | } | 2165 | } |
| 2166 | | 2166 | |
| 2167 | const node = try arena.construct(ast.Node.SuffixOp{ | 2167 | const node = try arena.create(ast.Node.SuffixOp{ |
| 2168 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, | 2168 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, |
| 2169 | .lhs = lhs, | 2169 | .lhs = lhs, |
| 2170 | .op = ast.Node.SuffixOp.Op{ .ArrayInitializer = ast.Node.SuffixOp.Op.InitList.init(arena) }, | 2170 | .op = ast.Node.SuffixOp.Op{ .ArrayInitializer = ast.Node.SuffixOp.Op.InitList.init(arena) }, |
| ... | @@ -2193,7 +2193,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2193,7 +2193,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2193 | const lhs = opt_ctx.get() orelse continue; | 2193 | const lhs = opt_ctx.get() orelse continue; |
| 2194 | | 2194 | |
| 2195 | if (eatToken(&tok_it, &tree, Token.Id.Bang)) |bang| { | 2195 | if (eatToken(&tok_it, &tree, Token.Id.Bang)) |bang| { |
| 2196 | const node = try arena.construct(ast.Node.InfixOp{ | 2196 | const node = try arena.create(ast.Node.InfixOp{ |
| 2197 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 2197 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 2198 | .lhs = lhs, | 2198 | .lhs = lhs, |
| 2199 | .op_token = bang, | 2199 | .op_token = bang, |
| ... | @@ -2212,7 +2212,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2212,7 +2212,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2212 | const token_index = token.index; | 2212 | const token_index = token.index; |
| 2213 | const token_ptr = token.ptr; | 2213 | const token_ptr = token.ptr; |
| 2214 | if (tokenIdToPrefixOp(token_ptr.id)) |prefix_id| { | 2214 | if (tokenIdToPrefixOp(token_ptr.id)) |prefix_id| { |
| 2215 | var node = try arena.construct(ast.Node.PrefixOp{ | 2215 | var node = try arena.create(ast.Node.PrefixOp{ |
| 2216 | .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, | 2216 | .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, |
| 2217 | .op_token = token_index, | 2217 | .op_token = token_index, |
| 2218 | .op = prefix_id, | 2218 | .op = prefix_id, |
| ... | @@ -2222,7 +2222,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2222,7 +2222,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2222 | | 2222 | |
| 2223 | // Treat '**' token as two pointer types | 2223 | // Treat '**' token as two pointer types |
| 2224 | if (token_ptr.id == Token.Id.AsteriskAsterisk) { | 2224 | if (token_ptr.id == Token.Id.AsteriskAsterisk) { |
| 2225 | const child = try arena.construct(ast.Node.PrefixOp{ | 2225 | const child = try arena.create(ast.Node.PrefixOp{ |
| 2226 | .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, | 2226 | .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, |
| 2227 | .op_token = token_index, | 2227 | .op_token = token_index, |
| 2228 | .op = prefix_id, | 2228 | .op = prefix_id, |
| ... | @@ -2246,7 +2246,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2246,7 +2246,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2246 | | 2246 | |
| 2247 | State.SuffixOpExpressionBegin => |opt_ctx| { | 2247 | State.SuffixOpExpressionBegin => |opt_ctx| { |
| 2248 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_async)) |async_token| { | 2248 | if (eatToken(&tok_it, &tree, Token.Id.Keyword_async)) |async_token| { |
| 2249 | const async_node = try arena.construct(ast.Node.AsyncAttribute{ | 2249 | const async_node = try arena.create(ast.Node.AsyncAttribute{ |
| 2250 | .base = ast.Node{ .id = ast.Node.Id.AsyncAttribute }, | 2250 | .base = ast.Node{ .id = ast.Node.Id.AsyncAttribute }, |
| 2251 | .async_token = async_token, | 2251 | .async_token = async_token, |
| 2252 | .allocator_type = null, | 2252 | .allocator_type = null, |
| ... | @@ -2277,7 +2277,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2277,7 +2277,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2277 | const token_ptr = token.ptr; | 2277 | const token_ptr = token.ptr; |
| 2278 | switch (token_ptr.id) { | 2278 | switch (token_ptr.id) { |
| 2279 | Token.Id.LParen => { | 2279 | Token.Id.LParen => { |
| 2280 | const node = try arena.construct(ast.Node.SuffixOp{ | 2280 | const node = try arena.create(ast.Node.SuffixOp{ |
| 2281 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, | 2281 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, |
| 2282 | .lhs = lhs, | 2282 | .lhs = lhs, |
| 2283 | .op = ast.Node.SuffixOp.Op{ | 2283 | .op = ast.Node.SuffixOp.Op{ |
| ... | @@ -2301,7 +2301,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2301,7 +2301,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2301 | continue; | 2301 | continue; |
| 2302 | }, | 2302 | }, |
| 2303 | Token.Id.LBracket => { | 2303 | Token.Id.LBracket => { |
| 2304 | const node = try arena.construct(ast.Node.SuffixOp{ | 2304 | const node = try arena.create(ast.Node.SuffixOp{ |
| 2305 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, | 2305 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, |
| 2306 | .lhs = lhs, | 2306 | .lhs = lhs, |
| 2307 | .op = ast.Node.SuffixOp.Op{ .ArrayAccess = undefined }, | 2307 | .op = ast.Node.SuffixOp.Op{ .ArrayAccess = undefined }, |
| ... | @@ -2316,7 +2316,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2316,7 +2316,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2316 | }, | 2316 | }, |
| 2317 | Token.Id.Period => { | 2317 | Token.Id.Period => { |
| 2318 | if (eatToken(&tok_it, &tree, Token.Id.Asterisk)) |asterisk_token| { | 2318 | if (eatToken(&tok_it, &tree, Token.Id.Asterisk)) |asterisk_token| { |
| 2319 | const node = try arena.construct(ast.Node.SuffixOp{ | 2319 | const node = try arena.create(ast.Node.SuffixOp{ |
| 2320 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, | 2320 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, |
| 2321 | .lhs = lhs, | 2321 | .lhs = lhs, |
| 2322 | .op = ast.Node.SuffixOp.Op.Deref, | 2322 | .op = ast.Node.SuffixOp.Op.Deref, |
| ... | @@ -2327,7 +2327,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2327,7 +2327,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2327 | continue; | 2327 | continue; |
| 2328 | } | 2328 | } |
| 2329 | if (eatToken(&tok_it, &tree, Token.Id.QuestionMark)) |question_token| { | 2329 | if (eatToken(&tok_it, &tree, Token.Id.QuestionMark)) |question_token| { |
| 2330 | const node = try arena.construct(ast.Node.SuffixOp{ | 2330 | const node = try arena.create(ast.Node.SuffixOp{ |
| 2331 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, | 2331 | .base = ast.Node{ .id = ast.Node.Id.SuffixOp }, |
| 2332 | .lhs = lhs, | 2332 | .lhs = lhs, |
| 2333 | .op = ast.Node.SuffixOp.Op.UnwrapOptional, | 2333 | .op = ast.Node.SuffixOp.Op.UnwrapOptional, |
| ... | @@ -2337,7 +2337,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2337,7 +2337,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2337 | stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }) catch unreachable; | 2337 | stack.append(State{ .SuffixOpExpressionEnd = opt_ctx.toRequired() }) catch unreachable; |
| 2338 | continue; | 2338 | continue; |
| 2339 | } | 2339 | } |
| 2340 | const node = try arena.construct(ast.Node.InfixOp{ | 2340 | const node = try arena.create(ast.Node.InfixOp{ |
| 2341 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, | 2341 | .base = ast.Node{ .id = ast.Node.Id.InfixOp }, |
| 2342 | .lhs = lhs, | 2342 | .lhs = lhs, |
| 2343 | .op_token = token_index, | 2343 | .op_token = token_index, |
| ... | @@ -2397,7 +2397,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2397,7 +2397,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2397 | continue; | 2397 | continue; |
| 2398 | }, | 2398 | }, |
| 2399 | Token.Id.Keyword_promise => { | 2399 | Token.Id.Keyword_promise => { |
| 2400 | const node = try arena.construct(ast.Node.PromiseType{ | 2400 | const node = try arena.create(ast.Node.PromiseType{ |
| 2401 | .base = ast.Node{ .id = ast.Node.Id.PromiseType }, | 2401 | .base = ast.Node{ .id = ast.Node.Id.PromiseType }, |
| 2402 | .promise_token = token.index, | 2402 | .promise_token = token.index, |
| 2403 | .result = null, | 2403 | .result = null, |
| ... | @@ -2423,7 +2423,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2423,7 +2423,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2423 | continue; | 2423 | continue; |
| 2424 | }, | 2424 | }, |
| 2425 | Token.Id.LParen => { | 2425 | Token.Id.LParen => { |
| 2426 | const node = try arena.construct(ast.Node.GroupedExpression{ | 2426 | const node = try arena.create(ast.Node.GroupedExpression{ |
| 2427 | .base = ast.Node{ .id = ast.Node.Id.GroupedExpression }, | 2427 | .base = ast.Node{ .id = ast.Node.Id.GroupedExpression }, |
| 2428 | .lparen = token.index, | 2428 | .lparen = token.index, |
| 2429 | .expr = undefined, | 2429 | .expr = undefined, |
| ... | @@ -2441,7 +2441,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2441,7 +2441,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2441 | continue; | 2441 | continue; |
| 2442 | }, | 2442 | }, |
| 2443 | Token.Id.Builtin => { | 2443 | Token.Id.Builtin => { |
| 2444 | const node = try arena.construct(ast.Node.BuiltinCall{ | 2444 | const node = try arena.create(ast.Node.BuiltinCall{ |
| 2445 | .base = ast.Node{ .id = ast.Node.Id.BuiltinCall }, | 2445 | .base = ast.Node{ .id = ast.Node.Id.BuiltinCall }, |
| 2446 | .builtin_token = token.index, | 2446 | .builtin_token = token.index, |
| 2447 | .params = ast.Node.BuiltinCall.ParamList.init(arena), | 2447 | .params = ast.Node.BuiltinCall.ParamList.init(arena), |
| ... | @@ -2460,7 +2460,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2460,7 +2460,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2460 | continue; | 2460 | continue; |
| 2461 | }, | 2461 | }, |
| 2462 | Token.Id.LBracket => { | 2462 | Token.Id.LBracket => { |
| 2463 | const node = try arena.construct(ast.Node.PrefixOp{ | 2463 | const node = try arena.create(ast.Node.PrefixOp{ |
| 2464 | .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, | 2464 | .base = ast.Node{ .id = ast.Node.Id.PrefixOp }, |
| 2465 | .op_token = token.index, | 2465 | .op_token = token.index, |
| 2466 | .op = undefined, | 2466 | .op = undefined, |
| ... | @@ -2519,7 +2519,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2519,7 +2519,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2519 | continue; | 2519 | continue; |
| 2520 | }, | 2520 | }, |
| 2521 | Token.Id.Keyword_fn => { | 2521 | Token.Id.Keyword_fn => { |
| 2522 | const fn_proto = try arena.construct(ast.Node.FnProto{ | 2522 | const fn_proto = try arena.create(ast.Node.FnProto{ |
| 2523 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, | 2523 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, |
| 2524 | .doc_comments = null, | 2524 | .doc_comments = null, |
| 2525 | .visib_token = null, | 2525 | .visib_token = null, |
| ... | @@ -2540,7 +2540,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2540,7 +2540,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2540 | continue; | 2540 | continue; |
| 2541 | }, | 2541 | }, |
| 2542 | Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc => { | 2542 | Token.Id.Keyword_nakedcc, Token.Id.Keyword_stdcallcc => { |
| 2543 | const fn_proto = try arena.construct(ast.Node.FnProto{ | 2543 | const fn_proto = try arena.create(ast.Node.FnProto{ |
| 2544 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, | 2544 | .base = ast.Node{ .id = ast.Node.Id.FnProto }, |
| 2545 | .doc_comments = null, | 2545 | .doc_comments = null, |
| 2546 | .visib_token = null, | 2546 | .visib_token = null, |
| ... | @@ -2567,7 +2567,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2567,7 +2567,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2567 | continue; | 2567 | continue; |
| 2568 | }, | 2568 | }, |
| 2569 | Token.Id.Keyword_asm => { | 2569 | Token.Id.Keyword_asm => { |
| 2570 | const node = try arena.construct(ast.Node.Asm{ | 2570 | const node = try arena.create(ast.Node.Asm{ |
| 2571 | .base = ast.Node{ .id = ast.Node.Id.Asm }, | 2571 | .base = ast.Node{ .id = ast.Node.Id.Asm }, |
| 2572 | .asm_token = token.index, | 2572 | .asm_token = token.index, |
| 2573 | .volatile_token = null, | 2573 | .volatile_token = null, |
| ... | @@ -2629,7 +2629,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2629,7 +2629,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2629 | continue; | 2629 | continue; |
| 2630 | } | 2630 | } |
| 2631 | | 2631 | |
| 2632 | const node = try arena.construct(ast.Node.ErrorSetDecl{ | 2632 | const node = try arena.create(ast.Node.ErrorSetDecl{ |
| 2633 | .base = ast.Node{ .id = ast.Node.Id.ErrorSetDecl }, | 2633 | .base = ast.Node{ .id = ast.Node.Id.ErrorSetDecl }, |
| 2634 | .error_token = ctx.error_token, | 2634 | .error_token = ctx.error_token, |
| 2635 | .decls = ast.Node.ErrorSetDecl.DeclList.init(arena), | 2635 | .decls = ast.Node.ErrorSetDecl.DeclList.init(arena), |
| ... | @@ -2695,7 +2695,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { | ... | @@ -2695,7 +2695,7 @@ pub fn parse(allocator: *mem.Allocator, source: []const u8) !ast.Tree { |
| 2695 | return tree; | 2695 | return tree; |
| 2696 | } | 2696 | } |
| 2697 | | 2697 | |
| 2698 | const node = try arena.construct(ast.Node.ErrorTag{ | 2698 | const node = try arena.create(ast.Node.ErrorTag{ |
| 2699 | .base = ast.Node{ .id = ast.Node.Id.ErrorTag }, | 2699 | .base = ast.Node{ .id = ast.Node.Id.ErrorTag }, |
| 2700 | .doc_comments = comments, | 2700 | .doc_comments = comments, |
| 2701 | .name_token = ident_token_index, | 2701 | .name_token = ident_token_index, |
| ... | @@ -3032,7 +3032,7 @@ fn pushDocComment(arena: *mem.Allocator, line_comment: TokenIndex, result: *?*as | ... | @@ -3032,7 +3032,7 @@ fn pushDocComment(arena: *mem.Allocator, line_comment: TokenIndex, result: *?*as |
| 3032 | if (result.*) |comment_node| { | 3032 | if (result.*) |comment_node| { |
| 3033 | break :blk comment_node; | 3033 | break :blk comment_node; |
| 3034 | } else { | 3034 | } else { |
| 3035 | const comment_node = try arena.construct(ast.Node.DocComment{ | 3035 | const comment_node = try arena.create(ast.Node.DocComment{ |
| 3036 | .base = ast.Node{ .id = ast.Node.Id.DocComment }, | 3036 | .base = ast.Node{ .id = ast.Node.Id.DocComment }, |
| 3037 | .lines = ast.Node.DocComment.LineList.init(arena), | 3037 | .lines = ast.Node.DocComment.LineList.init(arena), |
| 3038 | }); | 3038 | }); |
| ... | @@ -3061,7 +3061,7 @@ fn parseStringLiteral(arena: *mem.Allocator, tok_it: *ast.Tree.TokenList.Iterato | ... | @@ -3061,7 +3061,7 @@ fn parseStringLiteral(arena: *mem.Allocator, tok_it: *ast.Tree.TokenList.Iterato |
| 3061 | return &(try createLiteral(arena, ast.Node.StringLiteral, token_index)).base; | 3061 | return &(try createLiteral(arena, ast.Node.StringLiteral, token_index)).base; |
| 3062 | }, | 3062 | }, |
| 3063 | Token.Id.MultilineStringLiteralLine => { | 3063 | Token.Id.MultilineStringLiteralLine => { |
| 3064 | const node = try arena.construct(ast.Node.MultilineStringLiteral{ | 3064 | const node = try arena.create(ast.Node.MultilineStringLiteral{ |
| 3065 | .base = ast.Node{ .id = ast.Node.Id.MultilineStringLiteral }, | 3065 | .base = ast.Node{ .id = ast.Node.Id.MultilineStringLiteral }, |
| 3066 | .lines = ast.Node.MultilineStringLiteral.LineList.init(arena), | 3066 | .lines = ast.Node.MultilineStringLiteral.LineList.init(arena), |
| 3067 | }); | 3067 | }); |
| ... | @@ -3089,7 +3089,7 @@ fn parseStringLiteral(arena: *mem.Allocator, tok_it: *ast.Tree.TokenList.Iterato | ... | @@ -3089,7 +3089,7 @@ fn parseStringLiteral(arena: *mem.Allocator, tok_it: *ast.Tree.TokenList.Iterato |
| 3089 | fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *const OptionalCtx, token_ptr: *const Token, token_index: TokenIndex) !bool { | 3089 | fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *const OptionalCtx, token_ptr: *const Token, token_index: TokenIndex) !bool { |
| 3090 | switch (token_ptr.id) { | 3090 | switch (token_ptr.id) { |
| 3091 | Token.Id.Keyword_suspend => { | 3091 | Token.Id.Keyword_suspend => { |
| 3092 | const node = try arena.construct(ast.Node.Suspend{ | 3092 | const node = try arena.create(ast.Node.Suspend{ |
| 3093 | .base = ast.Node{ .id = ast.Node.Id.Suspend }, | 3093 | .base = ast.Node{ .id = ast.Node.Id.Suspend }, |
| 3094 | .label = null, | 3094 | .label = null, |
| 3095 | .suspend_token = token_index, | 3095 | .suspend_token = token_index, |
| ... | @@ -3103,7 +3103,7 @@ fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *con | ... | @@ -3103,7 +3103,7 @@ fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *con |
| 3103 | return true; | 3103 | return true; |
| 3104 | }, | 3104 | }, |
| 3105 | Token.Id.Keyword_if => { | 3105 | Token.Id.Keyword_if => { |
| 3106 | const node = try arena.construct(ast.Node.If{ | 3106 | const node = try arena.create(ast.Node.If{ |
| 3107 | .base = ast.Node{ .id = ast.Node.Id.If }, | 3107 | .base = ast.Node{ .id = ast.Node.Id.If }, |
| 3108 | .if_token = token_index, | 3108 | .if_token = token_index, |
| 3109 | .condition = undefined, | 3109 | .condition = undefined, |
| ... | @@ -3144,7 +3144,7 @@ fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *con | ... | @@ -3144,7 +3144,7 @@ fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *con |
| 3144 | return true; | 3144 | return true; |
| 3145 | }, | 3145 | }, |
| 3146 | Token.Id.Keyword_switch => { | 3146 | Token.Id.Keyword_switch => { |
| 3147 | const node = try arena.construct(ast.Node.Switch{ | 3147 | const node = try arena.create(ast.Node.Switch{ |
| 3148 | .base = ast.Node{ .id = ast.Node.Id.Switch }, | 3148 | .base = ast.Node{ .id = ast.Node.Id.Switch }, |
| 3149 | .switch_token = token_index, | 3149 | .switch_token = token_index, |
| 3150 | .expr = undefined, | 3150 | .expr = undefined, |
| ... | @@ -3166,7 +3166,7 @@ fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *con | ... | @@ -3166,7 +3166,7 @@ fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *con |
| 3166 | return true; | 3166 | return true; |
| 3167 | }, | 3167 | }, |
| 3168 | Token.Id.Keyword_comptime => { | 3168 | Token.Id.Keyword_comptime => { |
| 3169 | const node = try arena.construct(ast.Node.Comptime{ | 3169 | const node = try arena.create(ast.Node.Comptime{ |
| 3170 | .base = ast.Node{ .id = ast.Node.Id.Comptime }, | 3170 | .base = ast.Node{ .id = ast.Node.Id.Comptime }, |
| 3171 | .comptime_token = token_index, | 3171 | .comptime_token = token_index, |
| 3172 | .expr = undefined, | 3172 | .expr = undefined, |
| ... | @@ -3178,7 +3178,7 @@ fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *con | ... | @@ -3178,7 +3178,7 @@ fn parseBlockExpr(stack: *std.ArrayList(State), arena: *mem.Allocator, ctx: *con |
| 3178 | return true; | 3178 | return true; |
| 3179 | }, | 3179 | }, |
| 3180 | Token.Id.LBrace => { | 3180 | Token.Id.LBrace => { |
| 3181 | const block = try arena.construct(ast.Node.Block{ | 3181 | const block = try arena.create(ast.Node.Block{ |
| 3182 | .base = ast.Node{ .id = ast.Node.Id.Block }, | 3182 | .base = ast.Node{ .id = ast.Node.Id.Block }, |
| 3183 | .label = null, | 3183 | .label = null, |
| 3184 | .lbrace = token_index, | 3184 | .lbrace = token_index, |
| ... | @@ -3318,7 +3318,7 @@ fn tokenIdToPrefixOp(id: @TagType(Token.Id)) ?ast.Node.PrefixOp.Op { | ... | @@ -3318,7 +3318,7 @@ fn tokenIdToPrefixOp(id: @TagType(Token.Id)) ?ast.Node.PrefixOp.Op { |
| 3318 | } | 3318 | } |
| 3319 | | 3319 | |
| 3320 | fn createLiteral(arena: *mem.Allocator, comptime T: type, token_index: TokenIndex) !*T { | 3320 | fn createLiteral(arena: *mem.Allocator, comptime T: type, token_index: TokenIndex) !*T { |
| 3321 | return arena.construct(T{ | 3321 | return arena.create(T{ |
| 3322 | .base = ast.Node{ .id = ast.Node.typeToId(T) }, | 3322 | .base = ast.Node{ .id = ast.Node.typeToId(T) }, |
| 3323 | .token = token_index, | 3323 | .token = token_index, |
| 3324 | }); | 3324 | }); |