authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-03-20 21:59:28-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-03-20 21:59:28-07:00
logd8692b8bdb4630f2bb2763cdbe609de7d73b28d8
treeffc6b276760424460cfe620f7f2f7887b9ac013c
parent8bad5dfa72a33dec3919c3c3cb7590e51d03723b

astgen: implement string literals


2 files changed, 19 insertions(+), 58 deletions(-)

BRANCH_TODO+1
...@@ -30,3 +30,4 @@ Performance optimizations to look into:...@@ -30,3 +30,4 @@ Performance optimizations to look into:
30 * use a smaller encoding for the auto generated return void at the end of30 * use a smaller encoding for the auto generated return void at the end of
31 function ZIR.31 function ZIR.
32 * enum literals can use small strings32 * enum literals can use small strings
33 * string literals can use small strings
src/astgen.zig+18-58
...@@ -265,7 +265,6 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In...@@ -265,7 +265,6 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In
265 const token_tags = tree.tokens.items(.tag);265 const token_tags = tree.tokens.items(.tag);
266 const node_datas = tree.nodes.items(.data);266 const node_datas = tree.nodes.items(.data);
267 const node_tags = tree.nodes.items(.tag);267 const node_tags = tree.nodes.items(.tag);
268 const token_starts = tree.tokens.items(.start);
269268
270 const gz = scope.getGenZir();269 const gz = scope.getGenZir();
271270
...@@ -695,7 +694,6 @@ pub fn comptimeExpr(...@@ -695,7 +694,6 @@ pub fn comptimeExpr(
695694
696 const gz = parent_scope.getGenZir();695 const gz = parent_scope.getGenZir();
697 const tree = parent_scope.tree();696 const tree = parent_scope.tree();
698 const token_starts = tree.tokens.items(.start);
699697
700 // Make a scope to collect generated instructions in the sub-expression.698 // Make a scope to collect generated instructions in the sub-expression.
701 var block_scope: Scope.GenZir = .{699 var block_scope: Scope.GenZir = .{
...@@ -727,7 +725,6 @@ fn breakExpr(...@@ -727,7 +725,6 @@ fn breakExpr(
727 const tree = parent_scope.tree();725 const tree = parent_scope.tree();
728 const node_datas = tree.nodes.items(.data);726 const node_datas = tree.nodes.items(.data);
729 const main_tokens = tree.nodes.items(.main_token);727 const main_tokens = tree.nodes.items(.main_token);
730 const token_starts = tree.tokens.items(.start);
731728
732 const break_label = node_datas[node].lhs;729 const break_label = node_datas[node].lhs;
733 const rhs = node_datas[node].rhs;730 const rhs = node_datas[node].rhs;
...@@ -805,7 +802,6 @@ fn continueExpr(...@@ -805,7 +802,6 @@ fn continueExpr(
805 const tree = parent_scope.tree();802 const tree = parent_scope.tree();
806 const node_datas = tree.nodes.items(.data);803 const node_datas = tree.nodes.items(.data);
807 const main_tokens = tree.nodes.items(.main_token);804 const main_tokens = tree.nodes.items(.main_token);
808 const token_starts = tree.tokens.items(.start);
809805
810 const break_label = node_datas[node].lhs;806 const break_label = node_datas[node].lhs;
811807
...@@ -886,7 +882,6 @@ fn checkLabelRedefinition(mod: *Module, parent_scope: *Scope, label: ast.TokenIn...@@ -886,7 +882,6 @@ fn checkLabelRedefinition(mod: *Module, parent_scope: *Scope, label: ast.TokenIn
886 if (try tokenIdentEql(mod, parent_scope, label, prev_label.token)) {882 if (try tokenIdentEql(mod, parent_scope, label, prev_label.token)) {
887 const tree = parent_scope.tree();883 const tree = parent_scope.tree();
888 const main_tokens = tree.nodes.items(.main_token);884 const main_tokens = tree.nodes.items(.main_token);
889 const token_starts = tree.tokens.items(.start);
890885
891 const label_name = try mod.identifierTokenString(parent_scope, label);886 const label_name = try mod.identifierTokenString(parent_scope, label);
892 const msg = msg: {887 const msg = msg: {
...@@ -935,7 +930,6 @@ fn labeledBlockExpr(...@@ -935,7 +930,6 @@ fn labeledBlockExpr(
935930
936 const tree = parent_scope.tree();931 const tree = parent_scope.tree();
937 const main_tokens = tree.nodes.items(.main_token);932 const main_tokens = tree.nodes.items(.main_token);
938 const token_starts = tree.tokens.items(.start);
939 const token_tags = tree.tokens.items(.tag);933 const token_tags = tree.tokens.items(.tag);
940934
941 const lbrace = main_tokens[block_node];935 const lbrace = main_tokens[block_node];
...@@ -1018,7 +1012,6 @@ fn blockExprStmts(...@@ -1018,7 +1012,6 @@ fn blockExprStmts(
1018) !void {1012) !void {
1019 const tree = parent_scope.tree();1013 const tree = parent_scope.tree();
1020 const main_tokens = tree.nodes.items(.main_token);1014 const main_tokens = tree.nodes.items(.main_token);
1021 const token_starts = tree.tokens.items(.start);
1022 const node_tags = tree.nodes.items(.tag);1015 const node_tags = tree.nodes.items(.tag);
10231016
1024 var block_arena = std.heap.ArenaAllocator.init(mod.gpa);1017 var block_arena = std.heap.ArenaAllocator.init(mod.gpa);
...@@ -1297,7 +1290,6 @@ fn assignOp(...@@ -1297,7 +1290,6 @@ fn assignOp(
1297 const tree = scope.tree();1290 const tree = scope.tree();
1298 const node_datas = tree.nodes.items(.data);1291 const node_datas = tree.nodes.items(.data);
1299 const main_tokens = tree.nodes.items(.main_token);1292 const main_tokens = tree.nodes.items(.main_token);
1300 const token_starts = tree.tokens.items(.start);
13011293
1302 const lhs_ptr = try lvalExpr(mod, scope, node_datas[infix_node].lhs);1294 const lhs_ptr = try lvalExpr(mod, scope, node_datas[infix_node].lhs);
1303 const lhs = try addZIRUnOp(mod, scope, lhs_ptr.src, .deref, lhs_ptr);1295 const lhs = try addZIRUnOp(mod, scope, lhs_ptr.src, .deref, lhs_ptr);
...@@ -1336,7 +1328,6 @@ fn negation(...@@ -1336,7 +1328,6 @@ fn negation(
1336 const tree = scope.tree();1328 const tree = scope.tree();
1337 const node_datas = tree.nodes.items(.data);1329 const node_datas = tree.nodes.items(.data);
1338 const main_tokens = tree.nodes.items(.main_token);1330 const main_tokens = tree.nodes.items(.main_token);
1339 const token_starts = tree.tokens.items(.start);
13401331
1341 const lhs = try addZIRInstConst(mod, scope, src, .{1332 const lhs = try addZIRInstConst(mod, scope, src, .{
1342 .ty = Type.initTag(.comptime_int),1333 .ty = Type.initTag(.comptime_int),
...@@ -1354,7 +1345,6 @@ fn ptrType(...@@ -1354,7 +1345,6 @@ fn ptrType(
1354) InnerError!zir.Inst.Ref {1345) InnerError!zir.Inst.Ref {
1355 if (true) @panic("TODO update for zir-memory-layout");1346 if (true) @panic("TODO update for zir-memory-layout");
1356 const tree = scope.tree();1347 const tree = scope.tree();
1357 const token_starts = tree.tokens.items(.start);
13581348
1359 const simple = ptr_info.allowzero_token == null and1349 const simple = ptr_info.allowzero_token == null and
1360 ptr_info.ast.align_node == 0 and1350 ptr_info.ast.align_node == 0 and
...@@ -1399,7 +1389,6 @@ fn arrayType(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) !...@@ -1399,7 +1389,6 @@ fn arrayType(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) !
1399 const tree = scope.tree();1389 const tree = scope.tree();
1400 const main_tokens = tree.nodes.items(.main_token);1390 const main_tokens = tree.nodes.items(.main_token);
1401 const node_datas = tree.nodes.items(.data);1391 const node_datas = tree.nodes.items(.data);
1402 const token_starts = tree.tokens.items(.start);
14031392
1404 const usize_type = try addZIRInstConst(mod, scope, src, .{1393 const usize_type = try addZIRInstConst(mod, scope, src, .{
1405 .ty = Type.initTag(.type),1394 .ty = Type.initTag(.type),
...@@ -1425,7 +1414,6 @@ fn arrayTypeSentinel(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node....@@ -1425,7 +1414,6 @@ fn arrayTypeSentinel(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.
1425 if (true) @panic("TODO update for zir-memory-layout");1414 if (true) @panic("TODO update for zir-memory-layout");
1426 const tree = scope.tree();1415 const tree = scope.tree();
1427 const main_tokens = tree.nodes.items(.main_token);1416 const main_tokens = tree.nodes.items(.main_token);
1428 const token_starts = tree.tokens.items(.start);
1429 const node_datas = tree.nodes.items(.data);1417 const node_datas = tree.nodes.items(.data);
14301418
1431 const len_node = node_datas[node].lhs;1419 const len_node = node_datas[node].lhs;
...@@ -1469,7 +1457,6 @@ fn errorSetDecl(...@@ -1469,7 +1457,6 @@ fn errorSetDecl(
1469 const tree = scope.tree();1457 const tree = scope.tree();
1470 const main_tokens = tree.nodes.items(.main_token);1458 const main_tokens = tree.nodes.items(.main_token);
1471 const token_tags = tree.tokens.items(.tag);1459 const token_tags = tree.tokens.items(.tag);
1472 const token_starts = tree.tokens.items(.start);
14731460
1474 // Count how many fields there are.1461 // Count how many fields there are.
1475 const error_token = main_tokens[node];1462 const error_token = main_tokens[node];
...@@ -1521,7 +1508,6 @@ fn orelseCatchExpr(...@@ -1521,7 +1508,6 @@ fn orelseCatchExpr(
1521 if (true) @panic("TODO update for zir-memory-layout");1508 if (true) @panic("TODO update for zir-memory-layout");
15221509
1523 const tree = scope.tree();1510 const tree = scope.tree();
1524 const token_starts = tree.tokens.items(.start);
15251511
1526 var block_scope: Scope.GenZir = .{1512 var block_scope: Scope.GenZir = .{
1527 .parent = scope,1513 .parent = scope,
...@@ -1703,7 +1689,6 @@ fn tokenIdentEql(mod: *Module, scope: *Scope, token1: ast.TokenIndex, token2: as...@@ -1703,7 +1689,6 @@ fn tokenIdentEql(mod: *Module, scope: *Scope, token1: ast.TokenIndex, token2: as
1703pub fn fieldAccess(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) InnerError!zir.Inst.Ref {1689pub fn fieldAccess(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) InnerError!zir.Inst.Ref {
1704 if (true) @panic("TODO update for zir-memory-layout");1690 if (true) @panic("TODO update for zir-memory-layout");
1705 const tree = scope.tree();1691 const tree = scope.tree();
1706 const token_starts = tree.tokens.items(.start);
1707 const main_tokens = tree.nodes.items(.main_token);1692 const main_tokens = tree.nodes.items(.main_token);
1708 const node_datas = tree.nodes.items(.data);1693 const node_datas = tree.nodes.items(.data);
17091694
...@@ -1732,7 +1717,6 @@ fn arrayAccess(...@@ -1732,7 +1717,6 @@ fn arrayAccess(
1732 if (true) @panic("TODO update for zir-memory-layout");1717 if (true) @panic("TODO update for zir-memory-layout");
1733 const tree = scope.tree();1718 const tree = scope.tree();
1734 const main_tokens = tree.nodes.items(.main_token);1719 const main_tokens = tree.nodes.items(.main_token);
1735 const token_starts = tree.tokens.items(.start);
1736 const node_datas = tree.nodes.items(.data);1720 const node_datas = tree.nodes.items(.data);
17371721
1738 const usize_type = try addZIRInstConst(mod, scope, src, .{1722 const usize_type = try addZIRInstConst(mod, scope, src, .{
...@@ -1760,7 +1744,6 @@ fn sliceExpr(...@@ -1760,7 +1744,6 @@ fn sliceExpr(
1760) InnerError!zir.Inst.Ref {1744) InnerError!zir.Inst.Ref {
1761 if (true) @panic("TODO update for zir-memory-layout");1745 if (true) @panic("TODO update for zir-memory-layout");
1762 const tree = scope.tree();1746 const tree = scope.tree();
1763 const token_starts = tree.tokens.items(.start);
17641747
1765 const usize_type = try addZIRInstConst(mod, scope, src, .{1748 const usize_type = try addZIRInstConst(mod, scope, src, .{
1766 .ty = Type.initTag(.type),1749 .ty = Type.initTag(.type),
...@@ -1810,7 +1793,6 @@ fn simpleBinOp(...@@ -1810,7 +1793,6 @@ fn simpleBinOp(
1810 const tree = scope.tree();1793 const tree = scope.tree();
1811 const node_datas = tree.nodes.items(.data);1794 const node_datas = tree.nodes.items(.data);
1812 const main_tokens = tree.nodes.items(.main_token);1795 const main_tokens = tree.nodes.items(.main_token);
1813 const token_starts = tree.tokens.items(.start);
18141796
1815 const lhs = try expr(mod, scope, .none, node_datas[infix_node].lhs);1797 const lhs = try expr(mod, scope, .none, node_datas[infix_node].lhs);
1816 const rhs = try expr(mod, scope, .none, node_datas[infix_node].rhs);1798 const rhs = try expr(mod, scope, .none, node_datas[infix_node].rhs);
...@@ -1829,7 +1811,6 @@ fn boolBinOp(...@@ -1829,7 +1811,6 @@ fn boolBinOp(
1829 const tree = scope.tree();1811 const tree = scope.tree();
1830 const node_datas = tree.nodes.items(.data);1812 const node_datas = tree.nodes.items(.data);
1831 const main_tokens = tree.nodes.items(.main_token);1813 const main_tokens = tree.nodes.items(.main_token);
1832 const token_starts = tree.tokens.items(.start);
18331814
1834 const bool_type = try addZIRInstConst(mod, scope, src, .{1815 const bool_type = try addZIRInstConst(mod, scope, src, .{
1835 .ty = Type.initTag(.type),1816 .ty = Type.initTag(.type),
...@@ -1926,7 +1907,6 @@ fn ifExpr(...@@ -1926,7 +1907,6 @@ fn ifExpr(
19261907
1927 const tree = scope.tree();1908 const tree = scope.tree();
1928 const main_tokens = tree.nodes.items(.main_token);1909 const main_tokens = tree.nodes.items(.main_token);
1929 const token_starts = tree.tokens.items(.start);
19301910
1931 const if_src = token_starts[if_full.ast.if_token];1911 const if_src = token_starts[if_full.ast.if_token];
19321912
...@@ -2070,7 +2050,6 @@ fn whileExpr(...@@ -2070,7 +2050,6 @@ fn whileExpr(
20702050
2071 const tree = scope.tree();2051 const tree = scope.tree();
2072 const main_tokens = tree.nodes.items(.main_token);2052 const main_tokens = tree.nodes.items(.main_token);
2073 const token_starts = tree.tokens.items(.start);
20742053
2075 const while_src = token_starts[while_full.ast.while_token];2054 const while_src = token_starts[while_full.ast.while_token];
2076 const void_type = try addZIRInstConst(mod, scope, while_src, .{2055 const void_type = try addZIRInstConst(mod, scope, while_src, .{
...@@ -2210,7 +2189,6 @@ fn forExpr(...@@ -2210,7 +2189,6 @@ fn forExpr(
2210 // Set up variables and constants.2189 // Set up variables and constants.
2211 const tree = scope.tree();2190 const tree = scope.tree();
2212 const main_tokens = tree.nodes.items(.main_token);2191 const main_tokens = tree.nodes.items(.main_token);
2213 const token_starts = tree.tokens.items(.start);
2214 const token_tags = tree.tokens.items(.tag);2192 const token_tags = tree.tokens.items(.tag);
22152193
2216 const for_src = token_starts[for_full.ast.while_token];2194 const for_src = token_starts[for_full.ast.while_token];
...@@ -2416,7 +2394,6 @@ fn switchExpr(...@@ -2416,7 +2394,6 @@ fn switchExpr(
2416 const node_datas = tree.nodes.items(.data);2394 const node_datas = tree.nodes.items(.data);
2417 const main_tokens = tree.nodes.items(.main_token);2395 const main_tokens = tree.nodes.items(.main_token);
2418 const token_tags = tree.tokens.items(.tag);2396 const token_tags = tree.tokens.items(.tag);
2419 const token_starts = tree.tokens.items(.start);
2420 const node_tags = tree.nodes.items(.tag);2397 const node_tags = tree.nodes.items(.tag);
24212398
2422 const switch_token = main_tokens[switch_node];2399 const switch_token = main_tokens[switch_node];
...@@ -2707,7 +2684,6 @@ fn switchCaseExpr(...@@ -2707,7 +2684,6 @@ fn switchCaseExpr(
2707 const tree = scope.tree();2684 const tree = scope.tree();
2708 const node_datas = tree.nodes.items(.data);2685 const node_datas = tree.nodes.items(.data);
2709 const main_tokens = tree.nodes.items(.main_token);2686 const main_tokens = tree.nodes.items(.main_token);
2710 const token_starts = tree.tokens.items(.start);
2711 const token_tags = tree.tokens.items(.tag);2687 const token_tags = tree.tokens.items(.tag);
27122688
2713 const case_src = token_starts[case.ast.arrow_token];2689 const case_src = token_starts[case.ast.arrow_token];
...@@ -2833,41 +2809,29 @@ fn identifier(...@@ -2833,41 +2809,29 @@ fn identifier(
2833 return mod.failNode(scope, ident, "use of undeclared identifier '{s}'", .{ident_name});2809 return mod.failNode(scope, ident, "use of undeclared identifier '{s}'", .{ident_name});
2834}2810}
28352811
2836fn parseStringLiteral(mod: *Module, scope: *Scope, token: ast.TokenIndex) ![]u8 {
2837 const tree = scope.tree();
2838 const token_tags = tree.tokens.items(.tag);
2839 const token_starts = tree.tokens.items(.start);
2840 assert(token_tags[token] == .string_literal);
2841 const unparsed = tree.tokenSlice(token);
2842 const arena = scope.arena();
2843 var bad_index: usize = undefined;
2844 const bytes = std.zig.parseStringLiteral(arena, unparsed, &bad_index) catch |err| switch (err) {
2845 error.InvalidCharacter => {
2846 const bad_byte = unparsed[bad_index];
2847 return mod.fail(scope, src + bad_index, "invalid string literal character: '{c}'", .{
2848 bad_byte,
2849 });
2850 },
2851 else => |e| return e,
2852 };
2853 return bytes;
2854}
2855
2856fn stringLiteral(2812fn stringLiteral(
2857 mod: *Module,2813 mod: *Module,
2858 scope: *Scope,2814 scope: *Scope,
2859 rl: ResultLoc,2815 rl: ResultLoc,
2860 str_lit: ast.Node.Index,2816 node: ast.Node.Index,
2861) InnerError!zir.Inst.Ref {2817) InnerError!zir.Inst.Ref {
2862 if (true) @panic("TODO update for zir-memory-layout");
2863 const tree = scope.tree();2818 const tree = scope.tree();
2864 const main_tokens = tree.nodes.items(.main_token);2819 const main_tokens = tree.nodes.items(.main_token);
2865 const token_starts = tree.tokens.items(.start);2820 const gz = scope.getGenZir();
28662821 const string_bytes = &gz.zir_code.string_bytes;
2867 const str_lit_token = main_tokens[str_lit];2822 const str_index = string_bytes.items.len;
2868 const bytes = try parseStringLiteral(mod, scope, str_lit_token);2823 const str_lit_token = main_tokens[node];
2869 const str_inst = try addZIRInst(mod, scope, src, zir.Inst.Str, .{ .bytes = bytes }, .{});2824 const token_bytes = tree.tokenSlice(str_lit_token);
2870 return rvalue(mod, scope, rl, str_inst);2825 try mod.parseStrLit(scope, str_lit_token, string_bytes, token_bytes, 0);
2826 const str_len = string_bytes.items.len - str_index;
2827 const result = try gz.add(.{
2828 .tag = .str,
2829 .data = .{ .str = .{
2830 .start = @intCast(u32, str_index),
2831 .len = @intCast(u32, str_len),
2832 } },
2833 });
2834 return rvalue(mod, scope, rl, result, node);
2871}2835}
28722836
2873fn multilineStringLiteral(2837fn multilineStringLiteral(
...@@ -2880,7 +2844,6 @@ fn multilineStringLiteral(...@@ -2880,7 +2844,6 @@ fn multilineStringLiteral(
2880 const tree = scope.tree();2844 const tree = scope.tree();
2881 const node_datas = tree.nodes.items(.data);2845 const node_datas = tree.nodes.items(.data);
2882 const main_tokens = tree.nodes.items(.main_token);2846 const main_tokens = tree.nodes.items(.main_token);
2883 const token_starts = tree.tokens.items(.start);
28842847
2885 const start = node_datas[str_lit].lhs;2848 const start = node_datas[str_lit].lhs;
2886 const end = node_datas[str_lit].rhs;2849 const end = node_datas[str_lit].rhs;
...@@ -2924,7 +2887,6 @@ fn charLiteral(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index)...@@ -2924,7 +2887,6 @@ fn charLiteral(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index)
2924 const tree = scope.tree();2887 const tree = scope.tree();
2925 const main_tokens = tree.nodes.items(.main_token);2888 const main_tokens = tree.nodes.items(.main_token);
2926 const main_token = main_tokens[node];2889 const main_token = main_tokens[node];
2927 const token_starts = tree.tokens.items(.start);
29282890
2929 const slice = tree.tokenSlice(main_token);2891 const slice = tree.tokenSlice(main_token);
29302892
...@@ -2975,7 +2937,6 @@ fn floatLiteral(...@@ -2975,7 +2937,6 @@ fn floatLiteral(
2975 const arena = scope.arena();2937 const arena = scope.arena();
2976 const tree = scope.tree();2938 const tree = scope.tree();
2977 const main_tokens = tree.nodes.items(.main_token);2939 const main_tokens = tree.nodes.items(.main_token);
2978 const token_starts = tree.tokens.items(.start);
29792940
2980 const main_token = main_tokens[float_lit];2941 const main_token = main_tokens[float_lit];
2981 const bytes = tree.tokenSlice(main_token);2942 const bytes = tree.tokenSlice(main_token);
...@@ -3002,7 +2963,6 @@ fn asmExpr(...@@ -3002,7 +2963,6 @@ fn asmExpr(
3002 const arena = scope.arena();2963 const arena = scope.arena();
3003 const tree = scope.tree();2964 const tree = scope.tree();
3004 const main_tokens = tree.nodes.items(.main_token);2965 const main_tokens = tree.nodes.items(.main_token);
3005 const token_starts = tree.tokens.items(.start);
3006 const node_datas = tree.nodes.items(.data);2966 const node_datas = tree.nodes.items(.data);
3007 const gz = scope.getGenZir();2967 const gz = scope.getGenZir();
30082968
...@@ -3022,7 +2982,8 @@ fn asmExpr(...@@ -3022,7 +2982,8 @@ fn asmExpr(
3022 const constraint_token = main_tokens[input] + 2;2982 const constraint_token = main_tokens[input] + 2;
3023 const string_bytes = &gz.zir_code.string_bytes;2983 const string_bytes = &gz.zir_code.string_bytes;
3024 constraints[i] = @intCast(u32, string_bytes.items.len);2984 constraints[i] = @intCast(u32, string_bytes.items.len);
3025 try mod.appendIdentStr(scope, constraint_token, string_bytes);2985 const token_bytes = tree.tokenSlice(constraint_token);
2986 try mod.parseStrLit(scope, constraint_token, string_bytes, token_bytes, 0);
3026 try string_bytes.append(mod.gpa, 0);2987 try string_bytes.append(mod.gpa, 0);
30272988
3028 const usize_rl: ResultLoc = .{ .ty = @enumToInt(zir.Const.usize_type) };2989 const usize_rl: ResultLoc = .{ .ty = @enumToInt(zir.Const.usize_type) };
...@@ -3203,7 +3164,6 @@ fn builtinCall(...@@ -3203,7 +3164,6 @@ fn builtinCall(
3203 if (true) @panic("TODO update for zir-memory-layout");3164 if (true) @panic("TODO update for zir-memory-layout");
3204 const tree = scope.tree();3165 const tree = scope.tree();
3205 const main_tokens = tree.nodes.items(.main_token);3166 const main_tokens = tree.nodes.items(.main_token);
3206 const token_starts = tree.tokens.items(.start);
32073167
3208 const builtin_token = main_tokens[call];3168 const builtin_token = main_tokens[call];
3209 const builtin_name = tree.tokenSlice(builtin_token);3169 const builtin_name = tree.tokenSlice(builtin_token);