| ... | @@ -70,10 +70,10 @@ fn addExtra(astgen: *AstGen, extra: anytype) Allocator.Error!u32 { | ... | @@ -70,10 +70,10 @@ fn addExtra(astgen: *AstGen, extra: anytype) Allocator.Error!u32 { |
| 70 | | 70 | |
| 71 | fn addExtraAssumeCapacity(astgen: *AstGen, extra: anytype) u32 { | 71 | fn addExtraAssumeCapacity(astgen: *AstGen, extra: anytype) u32 { |
| 72 | const fields = std.meta.fields(@TypeOf(extra)); | 72 | const fields = std.meta.fields(@TypeOf(extra)); |
| 73 | const result = @as(u32, @intCast(astgen.extra.items.len)); | 73 | const extra_index: u32 = @intCast(astgen.extra.items.len); |
| 74 | astgen.extra.items.len += fields.len; | 74 | astgen.extra.items.len += fields.len; |
| 75 | setExtra(astgen, result, extra); | 75 | setExtra(astgen, extra_index, extra); |
| 76 | return result; | 76 | return extra_index; |
| 77 | } | 77 | } |
| 78 | | 78 | |
| 79 | fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { | 79 | fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { |
| ... | @@ -83,11 +83,12 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { | ... | @@ -83,11 +83,12 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { |
| 83 | astgen.extra.items[i] = switch (field.type) { | 83 | astgen.extra.items[i] = switch (field.type) { |
| 84 | u32 => @field(extra, field.name), | 84 | u32 => @field(extra, field.name), |
| 85 | Zir.Inst.Ref => @intFromEnum(@field(extra, field.name)), | 85 | Zir.Inst.Ref => @intFromEnum(@field(extra, field.name)), |
| 86 | i32 => @as(u32, @bitCast(@field(extra, field.name))), | 86 | i32, |
| 87 | Zir.Inst.Call.Flags => @as(u32, @bitCast(@field(extra, field.name))), | 87 | Zir.Inst.Call.Flags, |
| 88 | Zir.Inst.BuiltinCall.Flags => @as(u32, @bitCast(@field(extra, field.name))), | 88 | Zir.Inst.BuiltinCall.Flags, |
| 89 | Zir.Inst.SwitchBlock.Bits => @as(u32, @bitCast(@field(extra, field.name))), | 89 | Zir.Inst.SwitchBlock.Bits, |
| 90 | Zir.Inst.FuncFancy.Bits => @as(u32, @bitCast(@field(extra, field.name))), | 90 | Zir.Inst.FuncFancy.Bits, |
| | 91 | => @bitCast(@field(extra, field.name)), |
| 91 | else => @compileError("bad field type"), | 92 | else => @compileError("bad field type"), |
| 92 | }; | 93 | }; |
| 93 | i += 1; | 94 | i += 1; |
| ... | @@ -95,19 +96,17 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { | ... | @@ -95,19 +96,17 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { |
| 95 | } | 96 | } |
| 96 | | 97 | |
| 97 | fn reserveExtra(astgen: *AstGen, size: usize) Allocator.Error!u32 { | 98 | fn reserveExtra(astgen: *AstGen, size: usize) Allocator.Error!u32 { |
| 98 | const result = @as(u32, @intCast(astgen.extra.items.len)); | 99 | const extra_index: u32 = @intCast(astgen.extra.items.len); |
| 99 | try astgen.extra.resize(astgen.gpa, result + size); | 100 | try astgen.extra.resize(astgen.gpa, extra_index + size); |
| 100 | return result; | 101 | return extra_index; |
| 101 | } | 102 | } |
| 102 | | 103 | |
| 103 | fn appendRefs(astgen: *AstGen, refs: []const Zir.Inst.Ref) !void { | 104 | fn appendRefs(astgen: *AstGen, refs: []const Zir.Inst.Ref) !void { |
| 104 | const coerced = @as([]const u32, @ptrCast(refs)); | 105 | return astgen.extra.appendSlice(astgen.gpa, @ptrCast(refs)); |
| 105 | return astgen.extra.appendSlice(astgen.gpa, coerced); | | |
| 106 | } | 106 | } |
| 107 | | 107 | |
| 108 | fn appendRefsAssumeCapacity(astgen: *AstGen, refs: []const Zir.Inst.Ref) void { | 108 | fn appendRefsAssumeCapacity(astgen: *AstGen, refs: []const Zir.Inst.Ref) void { |
| 109 | const coerced = @as([]const u32, @ptrCast(refs)); | 109 | astgen.extra.appendSliceAssumeCapacity(@ptrCast(refs)); |
| 110 | astgen.extra.appendSliceAssumeCapacity(coerced); | | |
| 111 | } | 110 | } |
| 112 | | 111 | |
| 113 | pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { | 112 | pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| ... | @@ -176,7 +175,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { | ... | @@ -176,7 +175,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| 176 | @typeInfo(Zir.Inst.CompileErrors.Item).Struct.fields.len); | 175 | @typeInfo(Zir.Inst.CompileErrors.Item).Struct.fields.len); |
| 177 | | 176 | |
| 178 | astgen.extra.items[err_index] = astgen.addExtraAssumeCapacity(Zir.Inst.CompileErrors{ | 177 | astgen.extra.items[err_index] = astgen.addExtraAssumeCapacity(Zir.Inst.CompileErrors{ |
| 179 | .items_len = @as(u32, @intCast(astgen.compile_errors.items.len)), | 178 | .items_len = @intCast(astgen.compile_errors.items.len), |
| 180 | }); | 179 | }); |
| 181 | | 180 | |
| 182 | for (astgen.compile_errors.items) |item| { | 181 | for (astgen.compile_errors.items) |item| { |
| ... | @@ -192,7 +191,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { | ... | @@ -192,7 +191,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| 192 | astgen.imports.count() * @typeInfo(Zir.Inst.Imports.Item).Struct.fields.len); | 191 | astgen.imports.count() * @typeInfo(Zir.Inst.Imports.Item).Struct.fields.len); |
| 193 | | 192 | |
| 194 | astgen.extra.items[imports_index] = astgen.addExtraAssumeCapacity(Zir.Inst.Imports{ | 193 | astgen.extra.items[imports_index] = astgen.addExtraAssumeCapacity(Zir.Inst.Imports{ |
| 195 | .imports_len = @as(u32, @intCast(astgen.imports.count())), | 194 | .imports_len = @intCast(astgen.imports.count()), |
| 196 | }); | 195 | }); |
| 197 | | 196 | |
| 198 | var it = astgen.imports.iterator(); | 197 | var it = astgen.imports.iterator(); |
| ... | @@ -1334,7 +1333,7 @@ fn fnProtoExpr( | ... | @@ -1334,7 +1333,7 @@ fn fnProtoExpr( |
| 1334 | var param_gz = block_scope.makeSubBlock(scope); | 1333 | var param_gz = block_scope.makeSubBlock(scope); |
| 1335 | defer param_gz.unstack(); | 1334 | defer param_gz.unstack(); |
| 1336 | const param_type = try expr(&param_gz, scope, coerced_type_ri, param_type_node); | 1335 | const param_type = try expr(&param_gz, scope, coerced_type_ri, param_type_node); |
| 1337 | const param_inst_expected = @as(u32, @intCast(astgen.instructions.len + 1)); | 1336 | const param_inst_expected: u32 = @intCast(astgen.instructions.len + 1); |
| 1338 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); | 1337 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); |
| 1339 | const main_tokens = tree.nodes.items(.main_token); | 1338 | const main_tokens = tree.nodes.items(.main_token); |
| 1340 | const name_token = param.name_token orelse main_tokens[param_type_node]; | 1339 | const name_token = param.name_token orelse main_tokens[param_type_node]; |
| ... | @@ -1468,7 +1467,7 @@ fn arrayInitExpr( | ... | @@ -1468,7 +1467,7 @@ fn arrayInitExpr( |
| 1468 | const array_type_inst = try typeExpr(gz, scope, array_init.ast.type_expr); | 1467 | const array_type_inst = try typeExpr(gz, scope, array_init.ast.type_expr); |
| 1469 | _ = try gz.addPlNode(.validate_array_init_ty, node, Zir.Inst.ArrayInit{ | 1468 | _ = try gz.addPlNode(.validate_array_init_ty, node, Zir.Inst.ArrayInit{ |
| 1470 | .ty = array_type_inst, | 1469 | .ty = array_type_inst, |
| 1471 | .init_count = @as(u32, @intCast(array_init.ast.elements.len)), | 1470 | .init_count = @intCast(array_init.ast.elements.len), |
| 1472 | }); | 1471 | }); |
| 1473 | break :inst .{ | 1472 | break :inst .{ |
| 1474 | .array = array_type_inst, | 1473 | .array = array_type_inst, |
| ... | @@ -1552,7 +1551,7 @@ fn arrayInitExprRlNone( | ... | @@ -1552,7 +1551,7 @@ fn arrayInitExprRlNone( |
| 1552 | const astgen = gz.astgen; | 1551 | const astgen = gz.astgen; |
| 1553 | | 1552 | |
| 1554 | const payload_index = try addExtra(astgen, Zir.Inst.MultiOp{ | 1553 | const payload_index = try addExtra(astgen, Zir.Inst.MultiOp{ |
| 1555 | .operands_len = @as(u32, @intCast(elements.len)), | 1554 | .operands_len = @intCast(elements.len), |
| 1556 | }); | 1555 | }); |
| 1557 | var extra_index = try reserveExtra(astgen, elements.len); | 1556 | var extra_index = try reserveExtra(astgen, elements.len); |
| 1558 | | 1557 | |
| ... | @@ -1577,7 +1576,7 @@ fn arrayInitExprInner( | ... | @@ -1577,7 +1576,7 @@ fn arrayInitExprInner( |
| 1577 | | 1576 | |
| 1578 | const len = elements.len + @intFromBool(array_ty_inst != .none); | 1577 | const len = elements.len + @intFromBool(array_ty_inst != .none); |
| 1579 | const payload_index = try addExtra(astgen, Zir.Inst.MultiOp{ | 1578 | const payload_index = try addExtra(astgen, Zir.Inst.MultiOp{ |
| 1580 | .operands_len = @as(u32, @intCast(len)), | 1579 | .operands_len = @intCast(len), |
| 1581 | }); | 1580 | }); |
| 1582 | var extra_index = try reserveExtra(astgen, len); | 1581 | var extra_index = try reserveExtra(astgen, len); |
| 1583 | if (array_ty_inst != .none) { | 1582 | if (array_ty_inst != .none) { |
| ... | @@ -1593,7 +1592,7 @@ fn arrayInitExprInner( | ... | @@ -1593,7 +1592,7 @@ fn arrayInitExprInner( |
| 1593 | .tag = .elem_type_index, | 1592 | .tag = .elem_type_index, |
| 1594 | .data = .{ .bin = .{ | 1593 | .data = .{ .bin = .{ |
| 1595 | .lhs = array_ty_inst, | 1594 | .lhs = array_ty_inst, |
| 1596 | .rhs = @as(Zir.Inst.Ref, @enumFromInt(i)), | 1595 | .rhs = @enumFromInt(i), |
| 1597 | } }, | 1596 | } }, |
| 1598 | }); | 1597 | }); |
| 1599 | break :ri ResultInfo{ .rl = .{ .coerced_ty = ty_expr } }; | 1598 | break :ri ResultInfo{ .rl = .{ .coerced_ty = ty_expr } }; |
| ... | @@ -1638,14 +1637,14 @@ fn arrayInitExprRlPtrInner( | ... | @@ -1638,14 +1637,14 @@ fn arrayInitExprRlPtrInner( |
| 1638 | const astgen = gz.astgen; | 1637 | const astgen = gz.astgen; |
| 1639 | | 1638 | |
| 1640 | const payload_index = try addExtra(astgen, Zir.Inst.Block{ | 1639 | const payload_index = try addExtra(astgen, Zir.Inst.Block{ |
| 1641 | .body_len = @as(u32, @intCast(elements.len)), | 1640 | .body_len = @intCast(elements.len), |
| 1642 | }); | 1641 | }); |
| 1643 | var extra_index = try reserveExtra(astgen, elements.len); | 1642 | var extra_index = try reserveExtra(astgen, elements.len); |
| 1644 | | 1643 | |
| 1645 | for (elements, 0..) |elem_init, i| { | 1644 | for (elements, 0..) |elem_init, i| { |
| 1646 | const elem_ptr = try gz.addPlNode(.elem_ptr_imm, elem_init, Zir.Inst.ElemPtrImm{ | 1645 | const elem_ptr = try gz.addPlNode(.elem_ptr_imm, elem_init, Zir.Inst.ElemPtrImm{ |
| 1647 | .ptr = result_ptr, | 1646 | .ptr = result_ptr, |
| 1648 | .index = @as(u32, @intCast(i)), | 1647 | .index = @intCast(i), |
| 1649 | }); | 1648 | }); |
| 1650 | astgen.extra.items[extra_index] = refToIndex(elem_ptr).?; | 1649 | astgen.extra.items[extra_index] = refToIndex(elem_ptr).?; |
| 1651 | extra_index += 1; | 1650 | extra_index += 1; |
| ... | @@ -1797,7 +1796,7 @@ fn structInitExprRlNone( | ... | @@ -1797,7 +1796,7 @@ fn structInitExprRlNone( |
| 1797 | const tree = astgen.tree; | 1796 | const tree = astgen.tree; |
| 1798 | | 1797 | |
| 1799 | const payload_index = try addExtra(astgen, Zir.Inst.StructInitAnon{ | 1798 | const payload_index = try addExtra(astgen, Zir.Inst.StructInitAnon{ |
| 1800 | .fields_len = @as(u32, @intCast(struct_init.ast.fields.len)), | 1799 | .fields_len = @intCast(struct_init.ast.fields.len), |
| 1801 | }); | 1800 | }); |
| 1802 | const field_size = @typeInfo(Zir.Inst.StructInitAnon.Item).Struct.fields.len; | 1801 | const field_size = @typeInfo(Zir.Inst.StructInitAnon.Item).Struct.fields.len; |
| 1803 | var extra_index: usize = try reserveExtra(astgen, struct_init.ast.fields.len * field_size); | 1802 | var extra_index: usize = try reserveExtra(astgen, struct_init.ast.fields.len * field_size); |
| ... | @@ -1855,7 +1854,7 @@ fn structInitExprRlPtrInner( | ... | @@ -1855,7 +1854,7 @@ fn structInitExprRlPtrInner( |
| 1855 | const tree = astgen.tree; | 1854 | const tree = astgen.tree; |
| 1856 | | 1855 | |
| 1857 | const payload_index = try addExtra(astgen, Zir.Inst.Block{ | 1856 | const payload_index = try addExtra(astgen, Zir.Inst.Block{ |
| 1858 | .body_len = @as(u32, @intCast(struct_init.ast.fields.len)), | 1857 | .body_len = @intCast(struct_init.ast.fields.len), |
| 1859 | }); | 1858 | }); |
| 1860 | var extra_index = try reserveExtra(astgen, struct_init.ast.fields.len); | 1859 | var extra_index = try reserveExtra(astgen, struct_init.ast.fields.len); |
| 1861 | | 1860 | |
| ... | @@ -1887,7 +1886,7 @@ fn structInitExprRlTy( | ... | @@ -1887,7 +1886,7 @@ fn structInitExprRlTy( |
| 1887 | const tree = astgen.tree; | 1886 | const tree = astgen.tree; |
| 1888 | | 1887 | |
| 1889 | const payload_index = try addExtra(astgen, Zir.Inst.StructInit{ | 1888 | const payload_index = try addExtra(astgen, Zir.Inst.StructInit{ |
| 1890 | .fields_len = @as(u32, @intCast(struct_init.ast.fields.len)), | 1889 | .fields_len = @intCast(struct_init.ast.fields.len), |
| 1891 | }); | 1890 | }); |
| 1892 | const field_size = @typeInfo(Zir.Inst.StructInit.Item).Struct.fields.len; | 1891 | const field_size = @typeInfo(Zir.Inst.StructInit.Item).Struct.fields.len; |
| 1893 | var extra_index: usize = try reserveExtra(astgen, struct_init.ast.fields.len * field_size); | 1892 | var extra_index: usize = try reserveExtra(astgen, struct_init.ast.fields.len * field_size); |
| ... | @@ -2126,7 +2125,7 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn | ... | @@ -2126,7 +2125,7 @@ fn breakExpr(parent_gz: *GenZir, parent_scope: *Scope, node: Ast.Node.Index) Inn |
| 2126 | } | 2125 | } |
| 2127 | | 2126 | |
| 2128 | const operand = try reachableExpr(parent_gz, parent_scope, block_gz.break_result_info, rhs, node); | 2127 | const operand = try reachableExpr(parent_gz, parent_scope, block_gz.break_result_info, rhs, node); |
| 2129 | const search_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 2128 | const search_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 2130 | | 2129 | |
| 2131 | try genDefers(parent_gz, scope, parent_scope, .normal_only); | 2130 | try genDefers(parent_gz, scope, parent_scope, .normal_only); |
| 2132 | | 2131 | |
| ... | @@ -2942,7 +2941,7 @@ fn genDefers( | ... | @@ -2942,7 +2941,7 @@ fn genDefers( |
| 2942 | .index = defer_scope.index, | 2941 | .index = defer_scope.index, |
| 2943 | .len = defer_scope.len, | 2942 | .len = defer_scope.len, |
| 2944 | }); | 2943 | }); |
| 2945 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 2944 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 2946 | gz.astgen.instructions.appendAssumeCapacity(.{ | 2945 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 2947 | .tag = .defer_err_code, | 2946 | .tag = .defer_err_code, |
| 2948 | .data = .{ .defer_err_code = .{ | 2947 | .data = .{ .defer_err_code = .{ |
| ... | @@ -3021,7 +3020,7 @@ fn deferStmt( | ... | @@ -3021,7 +3020,7 @@ fn deferStmt( |
| 3021 | const sub_scope = if (!have_err_code) &defer_gen.base else blk: { | 3020 | const sub_scope = if (!have_err_code) &defer_gen.base else blk: { |
| 3022 | try gz.addDbgBlockBegin(); | 3021 | try gz.addDbgBlockBegin(); |
| 3023 | const ident_name = try gz.astgen.identAsString(payload_token); | 3022 | const ident_name = try gz.astgen.identAsString(payload_token); |
| 3024 | remapped_err_code = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 3023 | remapped_err_code = @intCast(gz.astgen.instructions.len); |
| 3025 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ | 3024 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ |
| 3026 | .tag = .extended, | 3025 | .tag = .extended, |
| 3027 | .data = .{ .extended = .{ | 3026 | .data = .{ .extended = .{ |
| ... | @@ -3061,7 +3060,7 @@ fn deferStmt( | ... | @@ -3061,7 +3060,7 @@ fn deferStmt( |
| 3061 | break :blk gz.astgen.countBodyLenAfterFixups(body) + refs; | 3060 | break :blk gz.astgen.countBodyLenAfterFixups(body) + refs; |
| 3062 | }; | 3061 | }; |
| 3063 | | 3062 | |
| 3064 | const index = @as(u32, @intCast(gz.astgen.extra.items.len)); | 3063 | const index: u32 = @intCast(gz.astgen.extra.items.len); |
| 3065 | try gz.astgen.extra.ensureUnusedCapacity(gz.astgen.gpa, body_len); | 3064 | try gz.astgen.extra.ensureUnusedCapacity(gz.astgen.gpa, body_len); |
| 3066 | if (have_err_code) { | 3065 | if (have_err_code) { |
| 3067 | if (gz.astgen.ref_table.fetchRemove(remapped_err_code)) |kv| { | 3066 | if (gz.astgen.ref_table.fetchRemove(remapped_err_code)) |kv| { |
| ... | @@ -3602,7 +3601,7 @@ fn ptrType( | ... | @@ -3602,7 +3601,7 @@ fn ptrType( |
| 3602 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(bit_end_ref)); | 3601 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(bit_end_ref)); |
| 3603 | } | 3602 | } |
| 3604 | | 3603 | |
| 3605 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 3604 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 3606 | const result = indexToRef(new_index); | 3605 | const result = indexToRef(new_index); |
| 3607 | gz.astgen.instructions.appendAssumeCapacity(.{ .tag = .ptr_type, .data = .{ | 3606 | gz.astgen.instructions.appendAssumeCapacity(.{ .tag = .ptr_type, .data = .{ |
| 3608 | .ptr_type = .{ | 3607 | .ptr_type = .{ |
| ... | @@ -3693,7 +3692,7 @@ const WipMembers = struct { | ... | @@ -3693,7 +3692,7 @@ const WipMembers = struct { |
| 3693 | const max_decl_size = 11; | 3692 | const max_decl_size = 11; |
| 3694 | | 3693 | |
| 3695 | fn init(gpa: Allocator, payload: *ArrayListUnmanaged(u32), decl_count: u32, field_count: u32, comptime bits_per_field: u32, comptime max_field_size: u32) Allocator.Error!Self { | 3694 | fn init(gpa: Allocator, payload: *ArrayListUnmanaged(u32), decl_count: u32, field_count: u32, comptime bits_per_field: u32, comptime max_field_size: u32) Allocator.Error!Self { |
| 3696 | const payload_top = @as(u32, @intCast(payload.items.len)); | 3695 | const payload_top: u32 = @intCast(payload.items.len); |
| 3697 | const decls_start = payload_top + (decl_count + decls_per_u32 - 1) / decls_per_u32; | 3696 | const decls_start = payload_top + (decl_count + decls_per_u32 - 1) / decls_per_u32; |
| 3698 | const field_bits_start = decls_start + decl_count * max_decl_size; | 3697 | const field_bits_start = decls_start + decl_count * max_decl_size; |
| 3699 | const fields_start = field_bits_start + if (bits_per_field > 0) blk: { | 3698 | const fields_start = field_bits_start + if (bits_per_field > 0) blk: { |
| ... | @@ -3748,7 +3747,7 @@ const WipMembers = struct { | ... | @@ -3748,7 +3747,7 @@ const WipMembers = struct { |
| 3748 | fn appendToDeclSlice(self: *Self, data: []const u32) void { | 3747 | fn appendToDeclSlice(self: *Self, data: []const u32) void { |
| 3749 | assert(self.decls_end + data.len <= self.field_bits_start); | 3748 | assert(self.decls_end + data.len <= self.field_bits_start); |
| 3750 | @memcpy(self.payload.items[self.decls_end..][0..data.len], data); | 3749 | @memcpy(self.payload.items[self.decls_end..][0..data.len], data); |
| 3751 | self.decls_end += @as(u32, @intCast(data.len)); | 3750 | self.decls_end += @intCast(data.len); |
| 3752 | } | 3751 | } |
| 3753 | | 3752 | |
| 3754 | fn appendToField(self: *Self, data: u32) void { | 3753 | fn appendToField(self: *Self, data: u32) void { |
| ... | @@ -3761,14 +3760,14 @@ const WipMembers = struct { | ... | @@ -3761,14 +3760,14 @@ const WipMembers = struct { |
| 3761 | const empty_decl_slots = decls_per_u32 - (self.decl_index % decls_per_u32); | 3760 | const empty_decl_slots = decls_per_u32 - (self.decl_index % decls_per_u32); |
| 3762 | if (self.decl_index > 0 and empty_decl_slots < decls_per_u32) { | 3761 | if (self.decl_index > 0 and empty_decl_slots < decls_per_u32) { |
| 3763 | const index = self.payload_top + self.decl_index / decls_per_u32; | 3762 | const index = self.payload_top + self.decl_index / decls_per_u32; |
| 3764 | self.payload.items[index] >>= @as(u5, @intCast(empty_decl_slots * bits_per_decl)); | 3763 | self.payload.items[index] >>= @intCast(empty_decl_slots * bits_per_decl); |
| 3765 | } | 3764 | } |
| 3766 | if (bits_per_field > 0) { | 3765 | if (bits_per_field > 0) { |
| 3767 | const fields_per_u32 = 32 / bits_per_field; | 3766 | const fields_per_u32 = 32 / bits_per_field; |
| 3768 | const empty_field_slots = fields_per_u32 - (self.field_index % fields_per_u32); | 3767 | const empty_field_slots = fields_per_u32 - (self.field_index % fields_per_u32); |
| 3769 | if (self.field_index > 0 and empty_field_slots < fields_per_u32) { | 3768 | if (self.field_index > 0 and empty_field_slots < fields_per_u32) { |
| 3770 | const index = self.field_bits_start + self.field_index / fields_per_u32; | 3769 | const index = self.field_bits_start + self.field_index / fields_per_u32; |
| 3771 | self.payload.items[index] >>= @as(u5, @intCast(empty_field_slots * bits_per_field)); | 3770 | self.payload.items[index] >>= @intCast(empty_field_slots * bits_per_field); |
| 3772 | } | 3771 | } |
| 3773 | } | 3772 | } |
| 3774 | } | 3773 | } |
| ... | @@ -3930,7 +3929,7 @@ fn fnDecl( | ... | @@ -3930,7 +3929,7 @@ fn fnDecl( |
| 3930 | var param_gz = decl_gz.makeSubBlock(scope); | 3929 | var param_gz = decl_gz.makeSubBlock(scope); |
| 3931 | defer param_gz.unstack(); | 3930 | defer param_gz.unstack(); |
| 3932 | const param_type = try expr(&param_gz, params_scope, coerced_type_ri, param_type_node); | 3931 | const param_type = try expr(&param_gz, params_scope, coerced_type_ri, param_type_node); |
| 3933 | const param_inst_expected = @as(u32, @intCast(astgen.instructions.len + 1)); | 3932 | const param_inst_expected: u32 = @intCast(astgen.instructions.len + 1); |
| 3934 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); | 3933 | _ = try param_gz.addBreakWithSrcNode(.break_inline, param_inst_expected, param_type, param_type_node); |
| 3935 | | 3934 | |
| 3936 | const main_tokens = tree.nodes.items(.main_token); | 3935 | const main_tokens = tree.nodes.items(.main_token); |
| ... | @@ -4144,9 +4143,8 @@ fn fnDecl( | ... | @@ -4144,9 +4143,8 @@ fn fnDecl( |
| 4144 | try decl_gz.setBlockBody(block_inst); | 4143 | try decl_gz.setBlockBody(block_inst); |
| 4145 | | 4144 | |
| 4146 | { | 4145 | { |
| 4147 | const contents_hash = std.zig.hashSrc(tree.getNodeSource(decl_node)); | 4146 | const contents_hash align(@alignOf(u32)) = std.zig.hashSrc(tree.getNodeSource(decl_node)); |
| 4148 | const casted = @as([4]u32, @bitCast(contents_hash)); | 4147 | wip_members.appendToDeclSlice(std.mem.bytesAsSlice(u32, &contents_hash)); |
| 4149 | wip_members.appendToDeclSlice(&casted); | | |
| 4150 | } | 4148 | } |
| 4151 | { | 4149 | { |
| 4152 | const line_delta = decl_gz.decl_line - gz.decl_line; | 4150 | const line_delta = decl_gz.decl_line - gz.decl_line; |
| ... | @@ -4295,9 +4293,8 @@ fn globalVarDecl( | ... | @@ -4295,9 +4293,8 @@ fn globalVarDecl( |
| 4295 | try block_scope.setBlockBody(block_inst); | 4293 | try block_scope.setBlockBody(block_inst); |
| 4296 | | 4294 | |
| 4297 | { | 4295 | { |
| 4298 | const contents_hash = std.zig.hashSrc(tree.getNodeSource(node)); | 4296 | const contents_hash align(@alignOf(u32)) = std.zig.hashSrc(tree.getNodeSource(node)); |
| 4299 | const casted = @as([4]u32, @bitCast(contents_hash)); | 4297 | wip_members.appendToDeclSlice(std.mem.bytesAsSlice(u32, &contents_hash)); |
| 4300 | wip_members.appendToDeclSlice(&casted); | | |
| 4301 | } | 4298 | } |
| 4302 | { | 4299 | { |
| 4303 | const line_delta = block_scope.decl_line - gz.decl_line; | 4300 | const line_delta = block_scope.decl_line - gz.decl_line; |
| ... | @@ -4350,9 +4347,8 @@ fn comptimeDecl( | ... | @@ -4350,9 +4347,8 @@ fn comptimeDecl( |
| 4350 | try decl_block.setBlockBody(block_inst); | 4347 | try decl_block.setBlockBody(block_inst); |
| 4351 | | 4348 | |
| 4352 | { | 4349 | { |
| 4353 | const contents_hash = std.zig.hashSrc(tree.getNodeSource(node)); | 4350 | const contents_hash align(@alignOf(u32)) = std.zig.hashSrc(tree.getNodeSource(node)); |
| 4354 | const casted = @as([4]u32, @bitCast(contents_hash)); | 4351 | wip_members.appendToDeclSlice(std.mem.bytesAsSlice(u32, &contents_hash)); |
| 4355 | wip_members.appendToDeclSlice(&casted); | | |
| 4356 | } | 4352 | } |
| 4357 | { | 4353 | { |
| 4358 | const line_delta = decl_block.decl_line - gz.decl_line; | 4354 | const line_delta = decl_block.decl_line - gz.decl_line; |
| ... | @@ -4402,9 +4398,8 @@ fn usingnamespaceDecl( | ... | @@ -4402,9 +4398,8 @@ fn usingnamespaceDecl( |
| 4402 | try decl_block.setBlockBody(block_inst); | 4398 | try decl_block.setBlockBody(block_inst); |
| 4403 | | 4399 | |
| 4404 | { | 4400 | { |
| 4405 | const contents_hash = std.zig.hashSrc(tree.getNodeSource(node)); | 4401 | const contents_hash align(@alignOf(u32)) = std.zig.hashSrc(tree.getNodeSource(node)); |
| 4406 | const casted = @as([4]u32, @bitCast(contents_hash)); | 4402 | wip_members.appendToDeclSlice(std.mem.bytesAsSlice(u32, &contents_hash)); |
| 4407 | wip_members.appendToDeclSlice(&casted); | | |
| 4408 | } | 4403 | } |
| 4409 | { | 4404 | { |
| 4410 | const line_delta = decl_block.decl_line - gz.decl_line; | 4405 | const line_delta = decl_block.decl_line - gz.decl_line; |
| ... | @@ -4589,9 +4584,8 @@ fn testDecl( | ... | @@ -4589,9 +4584,8 @@ fn testDecl( |
| 4589 | try decl_block.setBlockBody(block_inst); | 4584 | try decl_block.setBlockBody(block_inst); |
| 4590 | | 4585 | |
| 4591 | { | 4586 | { |
| 4592 | const contents_hash = std.zig.hashSrc(tree.getNodeSource(node)); | 4587 | const contents_hash align(@alignOf(u32)) = std.zig.hashSrc(tree.getNodeSource(node)); |
| 4593 | const casted = @as([4]u32, @bitCast(contents_hash)); | 4588 | wip_members.appendToDeclSlice(std.mem.bytesAsSlice(u32, &contents_hash)); |
| 4594 | wip_members.appendToDeclSlice(&casted); | | |
| 4595 | } | 4589 | } |
| 4596 | { | 4590 | { |
| 4597 | const line_delta = decl_block.decl_line - gz.decl_line; | 4591 | const line_delta = decl_block.decl_line - gz.decl_line; |
| ... | @@ -4690,7 +4684,7 @@ fn structDeclInner( | ... | @@ -4690,7 +4684,7 @@ fn structDeclInner( |
| 4690 | }; | 4684 | }; |
| 4691 | | 4685 | |
| 4692 | const decl_count = try astgen.scanDecls(&namespace, container_decl.ast.members); | 4686 | const decl_count = try astgen.scanDecls(&namespace, container_decl.ast.members); |
| 4693 | const field_count = @as(u32, @intCast(container_decl.ast.members.len - decl_count)); | 4687 | const field_count: u32 = @intCast(container_decl.ast.members.len - decl_count); |
| 4694 | | 4688 | |
| 4695 | const bits_per_field = 4; | 4689 | const bits_per_field = 4; |
| 4696 | const max_field_size = 5; | 4690 | const max_field_size = 5; |
| ... | @@ -4803,7 +4797,7 @@ fn structDeclInner( | ... | @@ -4803,7 +4797,7 @@ fn structDeclInner( |
| 4803 | const old_scratch_len = astgen.scratch.items.len; | 4797 | const old_scratch_len = astgen.scratch.items.len; |
| 4804 | try astgen.scratch.ensureUnusedCapacity(gpa, countBodyLenAfterFixups(astgen, body)); | 4798 | try astgen.scratch.ensureUnusedCapacity(gpa, countBodyLenAfterFixups(astgen, body)); |
| 4805 | appendBodyWithFixupsArrayList(astgen, &astgen.scratch, body); | 4799 | appendBodyWithFixupsArrayList(astgen, &astgen.scratch, body); |
| 4806 | wip_members.appendToField(@as(u32, @intCast(astgen.scratch.items.len - old_scratch_len))); | 4800 | wip_members.appendToField(@intCast(astgen.scratch.items.len - old_scratch_len)); |
| 4807 | block_scope.instructions.items.len = block_scope.instructions_top; | 4801 | block_scope.instructions.items.len = block_scope.instructions_top; |
| 4808 | } else { | 4802 | } else { |
| 4809 | wip_members.appendToField(@intFromEnum(field_type)); | 4803 | wip_members.appendToField(@intFromEnum(field_type)); |
| ... | @@ -4821,7 +4815,7 @@ fn structDeclInner( | ... | @@ -4821,7 +4815,7 @@ fn structDeclInner( |
| 4821 | const old_scratch_len = astgen.scratch.items.len; | 4815 | const old_scratch_len = astgen.scratch.items.len; |
| 4822 | try astgen.scratch.ensureUnusedCapacity(gpa, countBodyLenAfterFixups(astgen, body)); | 4816 | try astgen.scratch.ensureUnusedCapacity(gpa, countBodyLenAfterFixups(astgen, body)); |
| 4823 | appendBodyWithFixupsArrayList(astgen, &astgen.scratch, body); | 4817 | appendBodyWithFixupsArrayList(astgen, &astgen.scratch, body); |
| 4824 | wip_members.appendToField(@as(u32, @intCast(astgen.scratch.items.len - old_scratch_len))); | 4818 | wip_members.appendToField(@intCast(astgen.scratch.items.len - old_scratch_len)); |
| 4825 | block_scope.instructions.items.len = block_scope.instructions_top; | 4819 | block_scope.instructions.items.len = block_scope.instructions_top; |
| 4826 | } | 4820 | } |
| 4827 | | 4821 | |
| ... | @@ -4836,7 +4830,7 @@ fn structDeclInner( | ... | @@ -4836,7 +4830,7 @@ fn structDeclInner( |
| 4836 | const old_scratch_len = astgen.scratch.items.len; | 4830 | const old_scratch_len = astgen.scratch.items.len; |
| 4837 | try astgen.scratch.ensureUnusedCapacity(gpa, countBodyLenAfterFixups(astgen, body)); | 4831 | try astgen.scratch.ensureUnusedCapacity(gpa, countBodyLenAfterFixups(astgen, body)); |
| 4838 | appendBodyWithFixupsArrayList(astgen, &astgen.scratch, body); | 4832 | appendBodyWithFixupsArrayList(astgen, &astgen.scratch, body); |
| 4839 | wip_members.appendToField(@as(u32, @intCast(astgen.scratch.items.len - old_scratch_len))); | 4833 | wip_members.appendToField(@intCast(astgen.scratch.items.len - old_scratch_len)); |
| 4840 | block_scope.instructions.items.len = block_scope.instructions_top; | 4834 | block_scope.instructions.items.len = block_scope.instructions_top; |
| 4841 | } else if (member.comptime_token) |comptime_token| { | 4835 | } else if (member.comptime_token) |comptime_token| { |
| 4842 | return astgen.failTok(comptime_token, "comptime field without default initialization value", .{}); | 4836 | return astgen.failTok(comptime_token, "comptime field without default initialization value", .{}); |
| ... | @@ -4849,7 +4843,7 @@ fn structDeclInner( | ... | @@ -4849,7 +4843,7 @@ fn structDeclInner( |
| 4849 | .fields_len = field_count, | 4843 | .fields_len = field_count, |
| 4850 | .decls_len = decl_count, | 4844 | .decls_len = decl_count, |
| 4851 | .backing_int_ref = backing_int_ref, | 4845 | .backing_int_ref = backing_int_ref, |
| 4852 | .backing_int_body_len = @as(u32, @intCast(backing_int_body_len)), | 4846 | .backing_int_body_len = @intCast(backing_int_body_len), |
| 4853 | .known_non_opv = known_non_opv, | 4847 | .known_non_opv = known_non_opv, |
| 4854 | .known_comptime_only = known_comptime_only, | 4848 | .known_comptime_only = known_comptime_only, |
| 4855 | .is_tuple = is_tuple, | 4849 | .is_tuple = is_tuple, |
| ... | @@ -4909,7 +4903,7 @@ fn unionDeclInner( | ... | @@ -4909,7 +4903,7 @@ fn unionDeclInner( |
| 4909 | defer block_scope.unstack(); | 4903 | defer block_scope.unstack(); |
| 4910 | | 4904 | |
| 4911 | const decl_count = try astgen.scanDecls(&namespace, members); | 4905 | const decl_count = try astgen.scanDecls(&namespace, members); |
| 4912 | const field_count = @as(u32, @intCast(members.len - decl_count)); | 4906 | const field_count: u32 = @intCast(members.len - decl_count); |
| 4913 | | 4907 | |
| 4914 | if (layout != .Auto and (auto_enum_tok != null or arg_node != 0)) { | 4908 | if (layout != .Auto and (auto_enum_tok != null or arg_node != 0)) { |
| 4915 | const layout_str = if (layout == .Extern) "extern" else "packed"; | 4909 | const layout_str = if (layout == .Extern) "extern" else "packed"; |
| ... | @@ -5204,7 +5198,7 @@ fn containerDecl( | ... | @@ -5204,7 +5198,7 @@ fn containerDecl( |
| 5204 | | 5198 | |
| 5205 | const bits_per_field = 1; | 5199 | const bits_per_field = 1; |
| 5206 | const max_field_size = 3; | 5200 | const max_field_size = 3; |
| 5207 | var wip_members = try WipMembers.init(gpa, &astgen.scratch, @as(u32, @intCast(counts.decls)), @as(u32, @intCast(counts.total_fields)), bits_per_field, max_field_size); | 5201 | var wip_members = try WipMembers.init(gpa, &astgen.scratch, @intCast(counts.decls), @intCast(counts.total_fields), bits_per_field, max_field_size); |
| 5208 | defer wip_members.deinit(); | 5202 | defer wip_members.deinit(); |
| 5209 | | 5203 | |
| 5210 | for (container_decl.ast.members) |member_node| { | 5204 | for (container_decl.ast.members) |member_node| { |
| ... | @@ -5262,8 +5256,8 @@ fn containerDecl( | ... | @@ -5262,8 +5256,8 @@ fn containerDecl( |
| 5262 | .nonexhaustive = nonexhaustive, | 5256 | .nonexhaustive = nonexhaustive, |
| 5263 | .tag_type = arg_inst, | 5257 | .tag_type = arg_inst, |
| 5264 | .body_len = body_len, | 5258 | .body_len = body_len, |
| 5265 | .fields_len = @as(u32, @intCast(counts.total_fields)), | 5259 | .fields_len = @intCast(counts.total_fields), |
| 5266 | .decls_len = @as(u32, @intCast(counts.decls)), | 5260 | .decls_len = @intCast(counts.decls), |
| 5267 | }); | 5261 | }); |
| 5268 | | 5262 | |
| 5269 | wip_members.finishBits(bits_per_field); | 5263 | wip_members.finishBits(bits_per_field); |
| ... | @@ -5453,7 +5447,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi | ... | @@ -5453,7 +5447,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi |
| 5453 | } | 5447 | } |
| 5454 | | 5448 | |
| 5455 | setExtra(astgen, payload_index, Zir.Inst.ErrorSetDecl{ | 5449 | setExtra(astgen, payload_index, Zir.Inst.ErrorSetDecl{ |
| 5456 | .fields_len = @as(u32, @intCast(fields_len)), | 5450 | .fields_len = @intCast(fields_len), |
| 5457 | }); | 5451 | }); |
| 5458 | const result = try gz.addPlNodePayloadIndex(.error_set_decl, node, payload_index); | 5452 | const result = try gz.addPlNodePayloadIndex(.error_set_decl, node, payload_index); |
| 5459 | return rvalue(gz, ri, result, node); | 5453 | return rvalue(gz, ri, result, node); |
| ... | @@ -6356,10 +6350,10 @@ fn whileExpr( | ... | @@ -6356,10 +6350,10 @@ fn whileExpr( |
| 6356 | loop_scope.break_block = loop_block; | 6350 | loop_scope.break_block = loop_block; |
| 6357 | loop_scope.continue_block = continue_block; | 6351 | loop_scope.continue_block = continue_block; |
| 6358 | if (while_full.label_token) |label_token| { | 6352 | if (while_full.label_token) |label_token| { |
| 6359 | loop_scope.label = @as(?GenZir.Label, GenZir.Label{ | 6353 | loop_scope.label = .{ |
| 6360 | .token = label_token, | 6354 | .token = label_token, |
| 6361 | .block_inst = loop_block, | 6355 | .block_inst = loop_block, |
| 6362 | }); | 6356 | }; |
| 6363 | } | 6357 | } |
| 6364 | | 6358 | |
| 6365 | // done adding instructions to loop_scope, can now stack then_scope | 6359 | // done adding instructions to loop_scope, can now stack then_scope |
| ... | @@ -6972,7 +6966,7 @@ fn switchExpr( | ... | @@ -6972,7 +6966,7 @@ fn switchExpr( |
| 6972 | | 6966 | |
| 6973 | // If any prong has an inline tag capture, allocate a shared dummy instruction for it | 6967 | // If any prong has an inline tag capture, allocate a shared dummy instruction for it |
| 6974 | const tag_inst = if (any_has_tag_capture) tag_inst: { | 6968 | const tag_inst = if (any_has_tag_capture) tag_inst: { |
| 6975 | const inst = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 6969 | const inst: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 6976 | try astgen.instructions.append(astgen.gpa, .{ | 6970 | try astgen.instructions.append(astgen.gpa, .{ |
| 6977 | .tag = .extended, | 6971 | .tag = .extended, |
| 6978 | .data = .{ .extended = .{ | 6972 | .data = .{ .extended = .{ |
| ... | @@ -7065,7 +7059,7 @@ fn switchExpr( | ... | @@ -7065,7 +7059,7 @@ fn switchExpr( |
| 7065 | break :blk &tag_scope.base; | 7059 | break :blk &tag_scope.base; |
| 7066 | }; | 7060 | }; |
| 7067 | | 7061 | |
| 7068 | const header_index = @as(u32, @intCast(payloads.items.len)); | 7062 | const header_index: u32 = @intCast(payloads.items.len); |
| 7069 | const body_len_index = if (is_multi_case) blk: { | 7063 | const body_len_index = if (is_multi_case) blk: { |
| 7070 | payloads.items[multi_case_table + multi_case_index] = header_index; | 7064 | payloads.items[multi_case_table + multi_case_index] = header_index; |
| 7071 | multi_case_index += 1; | 7065 | multi_case_index += 1; |
| ... | @@ -7155,12 +7149,12 @@ fn switchExpr( | ... | @@ -7155,12 +7149,12 @@ fn switchExpr( |
| 7155 | }; | 7149 | }; |
| 7156 | const body_len = refs_len + astgen.countBodyLenAfterFixups(case_slice); | 7150 | const body_len = refs_len + astgen.countBodyLenAfterFixups(case_slice); |
| 7157 | try payloads.ensureUnusedCapacity(gpa, body_len); | 7151 | try payloads.ensureUnusedCapacity(gpa, body_len); |
| 7158 | payloads.items[body_len_index] = @as(u32, @bitCast(Zir.Inst.SwitchBlock.ProngInfo{ | 7152 | payloads.items[body_len_index] = @bitCast(Zir.Inst.SwitchBlock.ProngInfo{ |
| 7159 | .body_len = @as(u28, @intCast(body_len)), | 7153 | .body_len = @intCast(body_len), |
| 7160 | .capture = capture, | 7154 | .capture = capture, |
| 7161 | .is_inline = case.inline_token != null, | 7155 | .is_inline = case.inline_token != null, |
| 7162 | .has_tag_capture = has_tag_capture, | 7156 | .has_tag_capture = has_tag_capture, |
| 7163 | })); | 7157 | }); |
| 7164 | if (astgen.ref_table.fetchRemove(switch_block)) |kv| { | 7158 | if (astgen.ref_table.fetchRemove(switch_block)) |kv| { |
| 7165 | appendPossiblyRefdBodyInst(astgen, payloads, kv.value); | 7159 | appendPossiblyRefdBodyInst(astgen, payloads, kv.value); |
| 7166 | } | 7160 | } |
| ... | @@ -7188,7 +7182,7 @@ fn switchExpr( | ... | @@ -7188,7 +7182,7 @@ fn switchExpr( |
| 7188 | .has_else = special_prong == .@"else", | 7182 | .has_else = special_prong == .@"else", |
| 7189 | .has_under = special_prong == .under, | 7183 | .has_under = special_prong == .under, |
| 7190 | .any_has_tag_capture = any_has_tag_capture, | 7184 | .any_has_tag_capture = any_has_tag_capture, |
| 7191 | .scalar_cases_len = @as(Zir.Inst.SwitchBlock.Bits.ScalarCasesLen, @intCast(scalar_cases_len)), | 7185 | .scalar_cases_len = @intCast(scalar_cases_len), |
| 7192 | }, | 7186 | }, |
| 7193 | }); | 7187 | }); |
| 7194 | | 7188 | |
| ... | @@ -7473,7 +7467,7 @@ fn parseBitCount(buf: []const u8) std.fmt.ParseIntError!u16 { | ... | @@ -7473,7 +7467,7 @@ fn parseBitCount(buf: []const u8) std.fmt.ParseIntError!u16 { |
| 7473 | }; | 7467 | }; |
| 7474 | | 7468 | |
| 7475 | if (x != 0) x = try std.math.mul(u16, x, 10); | 7469 | if (x != 0) x = try std.math.mul(u16, x, 10); |
| 7476 | x = try std.math.add(u16, x, @as(u16, digit)); | 7470 | x = try std.math.add(u16, x, digit); |
| 7477 | } | 7471 | } |
| 7478 | | 7472 | |
| 7479 | return x; | 7473 | return x; |
| ... | @@ -7687,7 +7681,7 @@ fn tunnelThroughClosure( | ... | @@ -7687,7 +7681,7 @@ fn tunnelThroughClosure( |
| 7687 | .src_tok = ns.?.declaring_gz.?.tokenIndexToRelative(token), | 7681 | .src_tok = ns.?.declaring_gz.?.tokenIndexToRelative(token), |
| 7688 | } }, | 7682 | } }, |
| 7689 | }); | 7683 | }); |
| 7690 | gop.value_ptr.* = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len - 1)); | 7684 | gop.value_ptr.* = @intCast(gz.astgen.instructions.len - 1); |
| 7691 | } | 7685 | } |
| 7692 | | 7686 | |
| 7693 | // Add an instruction to get the value from the closure into | 7687 | // Add an instruction to get the value from the closure into |
| ... | @@ -7767,7 +7761,7 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: | ... | @@ -7767,7 +7761,7 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: |
| 7767 | const gpa = astgen.gpa; | 7761 | const gpa = astgen.gpa; |
| 7768 | var big_int = try std.math.big.int.Managed.init(gpa); | 7762 | var big_int = try std.math.big.int.Managed.init(gpa); |
| 7769 | defer big_int.deinit(); | 7763 | defer big_int.deinit(); |
| 7770 | const prefix_offset = @as(u8, 2) * @intFromBool(base != .decimal); | 7764 | const prefix_offset: usize = if (base == .decimal) 0 else 2; |
| 7771 | big_int.setString(@intFromEnum(base), bytes[prefix_offset..]) catch |err| switch (err) { | 7765 | big_int.setString(@intFromEnum(base), bytes[prefix_offset..]) catch |err| switch (err) { |
| 7772 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` | 7766 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` |
| 7773 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above | 7767 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above |
| ... | @@ -7788,7 +7782,7 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: | ... | @@ -7788,7 +7782,7 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: |
| 7788 | }; | 7782 | }; |
| 7789 | // If the value fits into a f64 without losing any precision, store it that way. | 7783 | // If the value fits into a f64 without losing any precision, store it that way. |
| 7790 | @setFloatMode(.Strict); | 7784 | @setFloatMode(.Strict); |
| 7791 | const smaller_float = @as(f64, @floatCast(float_number)); | 7785 | const smaller_float: f64 = @floatCast(float_number); |
| 7792 | const bigger_again: f128 = smaller_float; | 7786 | const bigger_again: f128 = smaller_float; |
| 7793 | if (bigger_again == float_number) { | 7787 | if (bigger_again == float_number) { |
| 7794 | const result = try gz.addFloat(smaller_float); | 7788 | const result = try gz.addFloat(smaller_float); |
| ... | @@ -7796,12 +7790,12 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: | ... | @@ -7796,12 +7790,12 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: |
| 7796 | } | 7790 | } |
| 7797 | // We need to use 128 bits. Break the float into 4 u32 values so we can | 7791 | // We need to use 128 bits. Break the float into 4 u32 values so we can |
| 7798 | // put it into the `extra` array. | 7792 | // put it into the `extra` array. |
| 7799 | const int_bits = @as(u128, @bitCast(float_number)); | 7793 | const int_bits: u128 = @bitCast(float_number); |
| 7800 | const result = try gz.addPlNode(.float128, node, Zir.Inst.Float128{ | 7794 | const result = try gz.addPlNode(.float128, node, Zir.Inst.Float128{ |
| 7801 | .piece0 = @as(u32, @truncate(int_bits)), | 7795 | .piece0 = @truncate(int_bits), |
| 7802 | .piece1 = @as(u32, @truncate(int_bits >> 32)), | 7796 | .piece1 = @truncate(int_bits >> 32), |
| 7803 | .piece2 = @as(u32, @truncate(int_bits >> 64)), | 7797 | .piece2 = @truncate(int_bits >> 64), |
| 7804 | .piece3 = @as(u32, @truncate(int_bits >> 96)), | 7798 | .piece3 = @truncate(int_bits >> 96), |
| 7805 | }); | 7799 | }); |
| 7806 | return rvalue(gz, ri, result, source_node); | 7800 | return rvalue(gz, ri, result, source_node); |
| 7807 | }, | 7801 | }, |
| ... | @@ -7827,22 +7821,22 @@ fn failWithNumberError(astgen: *AstGen, err: std.zig.number_literal.Error, token | ... | @@ -7827,22 +7821,22 @@ fn failWithNumberError(astgen: *AstGen, err: std.zig.number_literal.Error, token |
| 7827 | }); | 7821 | }); |
| 7828 | }, | 7822 | }, |
| 7829 | .digit_after_base => return astgen.failTok(token, "expected a digit after base prefix", .{}), | 7823 | .digit_after_base => return astgen.failTok(token, "expected a digit after base prefix", .{}), |
| 7830 | .upper_case_base => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "base prefix must be lowercase", .{}), | 7824 | .upper_case_base => |i| return astgen.failOff(token, @intCast(i), "base prefix must be lowercase", .{}), |
| 7831 | .invalid_float_base => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "invalid base for float literal", .{}), | 7825 | .invalid_float_base => |i| return astgen.failOff(token, @intCast(i), "invalid base for float literal", .{}), |
| 7832 | .repeated_underscore => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "repeated digit separator", .{}), | 7826 | .repeated_underscore => |i| return astgen.failOff(token, @intCast(i), "repeated digit separator", .{}), |
| 7833 | .invalid_underscore_after_special => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "expected digit before digit separator", .{}), | 7827 | .invalid_underscore_after_special => |i| return astgen.failOff(token, @intCast(i), "expected digit before digit separator", .{}), |
| 7834 | .invalid_digit => |info| return astgen.failOff(token, @as(u32, @intCast(info.i)), "invalid digit '{c}' for {s} base", .{ bytes[info.i], @tagName(info.base) }), | 7828 | .invalid_digit => |info| return astgen.failOff(token, @intCast(info.i), "invalid digit '{c}' for {s} base", .{ bytes[info.i], @tagName(info.base) }), |
| 7835 | .invalid_digit_exponent => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "invalid digit '{c}' in exponent", .{bytes[i]}), | 7829 | .invalid_digit_exponent => |i| return astgen.failOff(token, @intCast(i), "invalid digit '{c}' in exponent", .{bytes[i]}), |
| 7836 | .duplicate_exponent => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "duplicate exponent", .{}), | 7830 | .duplicate_exponent => |i| return astgen.failOff(token, @intCast(i), "duplicate exponent", .{}), |
| 7837 | .exponent_after_underscore => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "expected digit before exponent", .{}), | 7831 | .exponent_after_underscore => |i| return astgen.failOff(token, @intCast(i), "expected digit before exponent", .{}), |
| 7838 | .special_after_underscore => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "expected digit before '{c}'", .{bytes[i]}), | 7832 | .special_after_underscore => |i| return astgen.failOff(token, @intCast(i), "expected digit before '{c}'", .{bytes[i]}), |
| 7839 | .trailing_special => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "expected digit after '{c}'", .{bytes[i - 1]}), | 7833 | .trailing_special => |i| return astgen.failOff(token, @intCast(i), "expected digit after '{c}'", .{bytes[i - 1]}), |
| 7840 | .trailing_underscore => |i| return astgen.failOff(token, @as(u32, @intCast(i)), "trailing digit separator", .{}), | 7834 | .trailing_underscore => |i| return astgen.failOff(token, @intCast(i), "trailing digit separator", .{}), |
| 7841 | .duplicate_period => unreachable, // Validated by tokenizer | 7835 | .duplicate_period => unreachable, // Validated by tokenizer |
| 7842 | .invalid_character => unreachable, // Validated by tokenizer | 7836 | .invalid_character => unreachable, // Validated by tokenizer |
| 7843 | .invalid_exponent_sign => |i| { | 7837 | .invalid_exponent_sign => |i| { |
| 7844 | assert(bytes.len >= 2 and bytes[0] == '0' and bytes[1] == 'x'); // Validated by tokenizer | 7838 | assert(bytes.len >= 2 and bytes[0] == '0' and bytes[1] == 'x'); // Validated by tokenizer |
| 7845 | return astgen.failOff(token, @as(u32, @intCast(i)), "sign '{c}' cannot follow digit '{c}' in hex base", .{ bytes[i], bytes[i - 1] }); | 7839 | return astgen.failOff(token, @intCast(i), "sign '{c}' cannot follow digit '{c}' in hex base", .{ bytes[i], bytes[i - 1] }); |
| 7846 | }, | 7840 | }, |
| 7847 | } | 7841 | } |
| 7848 | } | 7842 | } |
| ... | @@ -7909,7 +7903,7 @@ fn asmExpr( | ... | @@ -7909,7 +7903,7 @@ fn asmExpr( |
| 7909 | if (output_type_bits != 0) { | 7903 | if (output_type_bits != 0) { |
| 7910 | return astgen.failNode(output_node, "inline assembly allows up to one output value", .{}); | 7904 | return astgen.failNode(output_node, "inline assembly allows up to one output value", .{}); |
| 7911 | } | 7905 | } |
| 7912 | output_type_bits |= @as(u32, 1) << @as(u5, @intCast(i)); | 7906 | output_type_bits |= @as(u32, 1) << @intCast(i); |
| 7913 | const out_type_node = node_datas[output_node].lhs; | 7907 | const out_type_node = node_datas[output_node].lhs; |
| 7914 | const out_type_inst = try typeExpr(gz, scope, out_type_node); | 7908 | const out_type_inst = try typeExpr(gz, scope, out_type_node); |
| 7915 | outputs[i] = .{ | 7909 | outputs[i] = .{ |
| ... | @@ -8132,7 +8126,7 @@ fn ptrCast( | ... | @@ -8132,7 +8126,7 @@ fn ptrCast( |
| 8132 | node = node_datas[node].lhs; | 8126 | node = node_datas[node].lhs; |
| 8133 | } | 8127 | } |
| 8134 | | 8128 | |
| 8135 | const flags_i = @as(u5, @bitCast(flags)); | 8129 | const flags_i: u5 = @bitCast(flags); |
| 8136 | assert(flags_i != 0); | 8130 | assert(flags_i != 0); |
| 8137 | | 8131 | |
| 8138 | const ptr_only: Zir.Inst.FullPtrCastFlags = .{ .ptr_cast = true }; | 8132 | const ptr_only: Zir.Inst.FullPtrCastFlags = .{ .ptr_cast = true }; |
| ... | @@ -8219,8 +8213,8 @@ fn typeOf( | ... | @@ -8219,8 +8213,8 @@ fn typeOf( |
| 8219 | const body = typeof_scope.instructionsSlice(); | 8213 | const body = typeof_scope.instructionsSlice(); |
| 8220 | const body_len = astgen.countBodyLenAfterFixups(body); | 8214 | const body_len = astgen.countBodyLenAfterFixups(body); |
| 8221 | astgen.setExtra(payload_index, Zir.Inst.TypeOfPeer{ | 8215 | astgen.setExtra(payload_index, Zir.Inst.TypeOfPeer{ |
| 8222 | .body_len = @as(u32, @intCast(body_len)), | 8216 | .body_len = @intCast(body_len), |
| 8223 | .body_index = @as(u32, @intCast(astgen.extra.items.len)), | 8217 | .body_index = @intCast(astgen.extra.items.len), |
| 8224 | .src_node = gz.nodeIndexToRelative(node), | 8218 | .src_node = gz.nodeIndexToRelative(node), |
| 8225 | }); | 8219 | }); |
| 8226 | try astgen.extra.ensureUnusedCapacity(gpa, body_len); | 8220 | try astgen.extra.ensureUnusedCapacity(gpa, body_len); |
| ... | @@ -8579,7 +8573,7 @@ fn builtinCall( | ... | @@ -8579,7 +8573,7 @@ fn builtinCall( |
| 8579 | .node = gz.nodeIndexToRelative(node), | 8573 | .node = gz.nodeIndexToRelative(node), |
| 8580 | .operand = operand, | 8574 | .operand = operand, |
| 8581 | }); | 8575 | }); |
| 8582 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 8576 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 8583 | gz.astgen.instructions.appendAssumeCapacity(.{ | 8577 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 8584 | .tag = .extended, | 8578 | .tag = .extended, |
| 8585 | .data = .{ .extended = .{ | 8579 | .data = .{ .extended = .{ |
| ... | @@ -9234,7 +9228,7 @@ fn callExpr( | ... | @@ -9234,7 +9228,7 @@ fn callExpr( |
| 9234 | } | 9228 | } |
| 9235 | assert(node != 0); | 9229 | assert(node != 0); |
| 9236 | | 9230 | |
| 9237 | const call_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 9231 | const call_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 9238 | const call_inst = Zir.indexToRef(call_index); | 9232 | const call_inst = Zir.indexToRef(call_index); |
| 9239 | try gz.astgen.instructions.append(astgen.gpa, undefined); | 9233 | try gz.astgen.instructions.append(astgen.gpa, undefined); |
| 9240 | try gz.instructions.append(astgen.gpa, call_index); | 9234 | try gz.instructions.append(astgen.gpa, call_index); |
| ... | @@ -9258,7 +9252,7 @@ fn callExpr( | ... | @@ -9258,7 +9252,7 @@ fn callExpr( |
| 9258 | try astgen.scratch.ensureUnusedCapacity(astgen.gpa, countBodyLenAfterFixups(astgen, body)); | 9252 | try astgen.scratch.ensureUnusedCapacity(astgen.gpa, countBodyLenAfterFixups(astgen, body)); |
| 9259 | appendBodyWithFixupsArrayList(astgen, &astgen.scratch, body); | 9253 | appendBodyWithFixupsArrayList(astgen, &astgen.scratch, body); |
| 9260 | | 9254 | |
| 9261 | astgen.scratch.items[scratch_index] = @as(u32, @intCast(astgen.scratch.items.len - scratch_top)); | 9255 | astgen.scratch.items[scratch_index] = @intCast(astgen.scratch.items.len - scratch_top); |
| 9262 | scratch_index += 1; | 9256 | scratch_index += 1; |
| 9263 | } | 9257 | } |
| 9264 | | 9258 | |
| ... | @@ -9276,8 +9270,8 @@ fn callExpr( | ... | @@ -9276,8 +9270,8 @@ fn callExpr( |
| 9276 | .callee = callee_obj, | 9270 | .callee = callee_obj, |
| 9277 | .flags = .{ | 9271 | .flags = .{ |
| 9278 | .pop_error_return_trace = !propagate_error_trace, | 9272 | .pop_error_return_trace = !propagate_error_trace, |
| 9279 | .packed_modifier = @as(Zir.Inst.Call.Flags.PackedModifier, @intCast(@intFromEnum(modifier))), | 9273 | .packed_modifier = @intCast(@intFromEnum(modifier)), |
| 9280 | .args_len = @as(Zir.Inst.Call.Flags.PackedArgsLen, @intCast(call.ast.params.len)), | 9274 | .args_len = @intCast(call.ast.params.len), |
| 9281 | }, | 9275 | }, |
| 9282 | }); | 9276 | }); |
| 9283 | if (call.ast.params.len != 0) { | 9277 | if (call.ast.params.len != 0) { |
| ... | @@ -9297,8 +9291,8 @@ fn callExpr( | ... | @@ -9297,8 +9291,8 @@ fn callExpr( |
| 9297 | .field_name_start = callee_field.field_name_start, | 9291 | .field_name_start = callee_field.field_name_start, |
| 9298 | .flags = .{ | 9292 | .flags = .{ |
| 9299 | .pop_error_return_trace = !propagate_error_trace, | 9293 | .pop_error_return_trace = !propagate_error_trace, |
| 9300 | .packed_modifier = @as(Zir.Inst.Call.Flags.PackedModifier, @intCast(@intFromEnum(modifier))), | 9294 | .packed_modifier = @intCast(@intFromEnum(modifier)), |
| 9301 | .args_len = @as(Zir.Inst.Call.Flags.PackedArgsLen, @intCast(call.ast.params.len)), | 9295 | .args_len = @intCast(call.ast.params.len), |
| 9302 | }, | 9296 | }, |
| 9303 | }); | 9297 | }); |
| 9304 | if (call.ast.params.len != 0) { | 9298 | if (call.ast.params.len != 0) { |
| ... | @@ -10773,14 +10767,14 @@ fn appendErrorNodeNotes( | ... | @@ -10773,14 +10767,14 @@ fn appendErrorNodeNotes( |
| 10773 | ) Allocator.Error!void { | 10767 | ) Allocator.Error!void { |
| 10774 | @setCold(true); | 10768 | @setCold(true); |
| 10775 | const string_bytes = &astgen.string_bytes; | 10769 | const string_bytes = &astgen.string_bytes; |
| 10776 | const msg = @as(u32, @intCast(string_bytes.items.len)); | 10770 | const msg: u32 = @intCast(string_bytes.items.len); |
| 10777 | try string_bytes.writer(astgen.gpa).print(format ++ "\x00", args); | 10771 | try string_bytes.writer(astgen.gpa).print(format ++ "\x00", args); |
| 10778 | const notes_index: u32 = if (notes.len != 0) blk: { | 10772 | const notes_index: u32 = if (notes.len != 0) blk: { |
| 10779 | const notes_start = astgen.extra.items.len; | 10773 | const notes_start = astgen.extra.items.len; |
| 10780 | try astgen.extra.ensureTotalCapacity(astgen.gpa, notes_start + 1 + notes.len); | 10774 | try astgen.extra.ensureTotalCapacity(astgen.gpa, notes_start + 1 + notes.len); |
| 10781 | astgen.extra.appendAssumeCapacity(@as(u32, @intCast(notes.len))); | 10775 | astgen.extra.appendAssumeCapacity(@intCast(notes.len)); |
| 10782 | astgen.extra.appendSliceAssumeCapacity(notes); | 10776 | astgen.extra.appendSliceAssumeCapacity(notes); |
| 10783 | break :blk @as(u32, @intCast(notes_start)); | 10777 | break :blk @intCast(notes_start); |
| 10784 | } else 0; | 10778 | } else 0; |
| 10785 | try astgen.compile_errors.append(astgen.gpa, .{ | 10779 | try astgen.compile_errors.append(astgen.gpa, .{ |
| 10786 | .msg = msg, | 10780 | .msg = msg, |
| ... | @@ -10865,14 +10859,14 @@ fn appendErrorTokNotesOff( | ... | @@ -10865,14 +10859,14 @@ fn appendErrorTokNotesOff( |
| 10865 | @setCold(true); | 10859 | @setCold(true); |
| 10866 | const gpa = astgen.gpa; | 10860 | const gpa = astgen.gpa; |
| 10867 | const string_bytes = &astgen.string_bytes; | 10861 | const string_bytes = &astgen.string_bytes; |
| 10868 | const msg = @as(u32, @intCast(string_bytes.items.len)); | 10862 | const msg: u32 = @intCast(string_bytes.items.len); |
| 10869 | try string_bytes.writer(gpa).print(format ++ "\x00", args); | 10863 | try string_bytes.writer(gpa).print(format ++ "\x00", args); |
| 10870 | const notes_index: u32 = if (notes.len != 0) blk: { | 10864 | const notes_index: u32 = if (notes.len != 0) blk: { |
| 10871 | const notes_start = astgen.extra.items.len; | 10865 | const notes_start = astgen.extra.items.len; |
| 10872 | try astgen.extra.ensureTotalCapacity(gpa, notes_start + 1 + notes.len); | 10866 | try astgen.extra.ensureTotalCapacity(gpa, notes_start + 1 + notes.len); |
| 10873 | astgen.extra.appendAssumeCapacity(@as(u32, @intCast(notes.len))); | 10867 | astgen.extra.appendAssumeCapacity(@intCast(notes.len)); |
| 10874 | astgen.extra.appendSliceAssumeCapacity(notes); | 10868 | astgen.extra.appendSliceAssumeCapacity(notes); |
| 10875 | break :blk @as(u32, @intCast(notes_start)); | 10869 | break :blk @intCast(notes_start); |
| 10876 | } else 0; | 10870 | } else 0; |
| 10877 | try astgen.compile_errors.append(gpa, .{ | 10871 | try astgen.compile_errors.append(gpa, .{ |
| 10878 | .msg = msg, | 10872 | .msg = msg, |
| ... | @@ -10901,7 +10895,7 @@ fn errNoteTokOff( | ... | @@ -10901,7 +10895,7 @@ fn errNoteTokOff( |
| 10901 | ) Allocator.Error!u32 { | 10895 | ) Allocator.Error!u32 { |
| 10902 | @setCold(true); | 10896 | @setCold(true); |
| 10903 | const string_bytes = &astgen.string_bytes; | 10897 | const string_bytes = &astgen.string_bytes; |
| 10904 | const msg = @as(u32, @intCast(string_bytes.items.len)); | 10898 | const msg: u32 = @intCast(string_bytes.items.len); |
| 10905 | try string_bytes.writer(astgen.gpa).print(format ++ "\x00", args); | 10899 | try string_bytes.writer(astgen.gpa).print(format ++ "\x00", args); |
| 10906 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ | 10900 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ |
| 10907 | .msg = msg, | 10901 | .msg = msg, |
| ... | @@ -10920,7 +10914,7 @@ fn errNoteNode( | ... | @@ -10920,7 +10914,7 @@ fn errNoteNode( |
| 10920 | ) Allocator.Error!u32 { | 10914 | ) Allocator.Error!u32 { |
| 10921 | @setCold(true); | 10915 | @setCold(true); |
| 10922 | const string_bytes = &astgen.string_bytes; | 10916 | const string_bytes = &astgen.string_bytes; |
| 10923 | const msg = @as(u32, @intCast(string_bytes.items.len)); | 10917 | const msg: u32 = @intCast(string_bytes.items.len); |
| 10924 | try string_bytes.writer(astgen.gpa).print(format ++ "\x00", args); | 10918 | try string_bytes.writer(astgen.gpa).print(format ++ "\x00", args); |
| 10925 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ | 10919 | return astgen.addExtra(Zir.Inst.CompileErrors.Item{ |
| 10926 | .msg = msg, | 10920 | .msg = msg, |
| ... | @@ -10934,7 +10928,7 @@ fn errNoteNode( | ... | @@ -10934,7 +10928,7 @@ fn errNoteNode( |
| 10934 | fn identAsString(astgen: *AstGen, ident_token: Ast.TokenIndex) !u32 { | 10928 | fn identAsString(astgen: *AstGen, ident_token: Ast.TokenIndex) !u32 { |
| 10935 | const gpa = astgen.gpa; | 10929 | const gpa = astgen.gpa; |
| 10936 | const string_bytes = &astgen.string_bytes; | 10930 | const string_bytes = &astgen.string_bytes; |
| 10937 | const str_index = @as(u32, @intCast(string_bytes.items.len)); | 10931 | const str_index: u32 = @intCast(string_bytes.items.len); |
| 10938 | try astgen.appendIdentStr(ident_token, string_bytes); | 10932 | try astgen.appendIdentStr(ident_token, string_bytes); |
| 10939 | const key: []const u8 = string_bytes.items[str_index..]; | 10933 | const key: []const u8 = string_bytes.items[str_index..]; |
| 10940 | const gop = try astgen.string_table.getOrPutContextAdapted(gpa, key, StringIndexAdapter{ | 10934 | const gop = try astgen.string_table.getOrPutContextAdapted(gpa, key, StringIndexAdapter{ |
| ... | @@ -10956,7 +10950,7 @@ fn identAsString(astgen: *AstGen, ident_token: Ast.TokenIndex) !u32 { | ... | @@ -10956,7 +10950,7 @@ fn identAsString(astgen: *AstGen, ident_token: Ast.TokenIndex) !u32 { |
| 10956 | /// `end_token` must point at the first token after the last doc coment line. | 10950 | /// `end_token` must point at the first token after the last doc coment line. |
| 10957 | /// Returns 0 if no doc comment is present. | 10951 | /// Returns 0 if no doc comment is present. |
| 10958 | fn docCommentAsString(astgen: *AstGen, end_token: Ast.TokenIndex) !u32 { | 10952 | fn docCommentAsString(astgen: *AstGen, end_token: Ast.TokenIndex) !u32 { |
| 10959 | if (end_token == 0) return @as(u32, 0); | 10953 | if (end_token == 0) return 0; |
| 10960 | | 10954 | |
| 10961 | const token_tags = astgen.tree.tokens.items(.tag); | 10955 | const token_tags = astgen.tree.tokens.items(.tag); |
| 10962 | | 10956 | |
| ... | @@ -10980,7 +10974,7 @@ fn docCommentAsStringFromFirst( | ... | @@ -10980,7 +10974,7 @@ fn docCommentAsStringFromFirst( |
| 10980 | | 10974 | |
| 10981 | const gpa = astgen.gpa; | 10975 | const gpa = astgen.gpa; |
| 10982 | const string_bytes = &astgen.string_bytes; | 10976 | const string_bytes = &astgen.string_bytes; |
| 10983 | const str_index = @as(u32, @intCast(string_bytes.items.len)); | 10977 | const str_index: u32 = @intCast(string_bytes.items.len); |
| 10984 | const token_starts = astgen.tree.tokens.items(.start); | 10978 | const token_starts = astgen.tree.tokens.items(.start); |
| 10985 | const token_tags = astgen.tree.tokens.items(.tag); | 10979 | const token_tags = astgen.tree.tokens.items(.tag); |
| 10986 | | 10980 | |
| ... | @@ -11001,8 +10995,8 @@ fn docCommentAsStringFromFirst( | ... | @@ -11001,8 +10995,8 @@ fn docCommentAsStringFromFirst( |
| 11001 | } | 10995 | } |
| 11002 | } | 10996 | } |
| 11003 | | 10997 | |
| 11004 | const key = string_bytes.items[str_index..]; | 10998 | const key: []const u8 = string_bytes.items[str_index..]; |
| 11005 | const gop = try astgen.string_table.getOrPutContextAdapted(gpa, @as([]const u8, key), StringIndexAdapter{ | 10999 | const gop = try astgen.string_table.getOrPutContextAdapted(gpa, key, StringIndexAdapter{ |
| 11006 | .bytes = string_bytes, | 11000 | .bytes = string_bytes, |
| 11007 | }, StringIndexContext{ | 11001 | }, StringIndexContext{ |
| 11008 | .bytes = string_bytes, | 11002 | .bytes = string_bytes, |
| ... | @@ -11023,11 +11017,11 @@ const IndexSlice = struct { index: u32, len: u32 }; | ... | @@ -11023,11 +11017,11 @@ const IndexSlice = struct { index: u32, len: u32 }; |
| 11023 | fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { | 11017 | fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { |
| 11024 | const gpa = astgen.gpa; | 11018 | const gpa = astgen.gpa; |
| 11025 | const string_bytes = &astgen.string_bytes; | 11019 | const string_bytes = &astgen.string_bytes; |
| 11026 | const str_index = @as(u32, @intCast(string_bytes.items.len)); | 11020 | const str_index: u32 = @intCast(string_bytes.items.len); |
| 11027 | const token_bytes = astgen.tree.tokenSlice(str_lit_token); | 11021 | const token_bytes = astgen.tree.tokenSlice(str_lit_token); |
| 11028 | try astgen.parseStrLit(str_lit_token, string_bytes, token_bytes, 0); | 11022 | try astgen.parseStrLit(str_lit_token, string_bytes, token_bytes, 0); |
| 11029 | const key = string_bytes.items[str_index..]; | 11023 | const key: []const u8 = string_bytes.items[str_index..]; |
| 11030 | const gop = try astgen.string_table.getOrPutContextAdapted(gpa, @as([]const u8, key), StringIndexAdapter{ | 11024 | const gop = try astgen.string_table.getOrPutContextAdapted(gpa, key, StringIndexAdapter{ |
| 11031 | .bytes = string_bytes, | 11025 | .bytes = string_bytes, |
| 11032 | }, StringIndexContext{ | 11026 | }, StringIndexContext{ |
| 11033 | .bytes = string_bytes, | 11027 | .bytes = string_bytes, |
| ... | @@ -11036,7 +11030,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { | ... | @@ -11036,7 +11030,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { |
| 11036 | string_bytes.shrinkRetainingCapacity(str_index); | 11030 | string_bytes.shrinkRetainingCapacity(str_index); |
| 11037 | return IndexSlice{ | 11031 | return IndexSlice{ |
| 11038 | .index = gop.key_ptr.*, | 11032 | .index = gop.key_ptr.*, |
| 11039 | .len = @as(u32, @intCast(key.len)), | 11033 | .len = @intCast(key.len), |
| 11040 | }; | 11034 | }; |
| 11041 | } else { | 11035 | } else { |
| 11042 | gop.key_ptr.* = str_index; | 11036 | gop.key_ptr.* = str_index; |
| ... | @@ -11046,7 +11040,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { | ... | @@ -11046,7 +11040,7 @@ fn strLitAsString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !IndexSlice { |
| 11046 | try string_bytes.append(gpa, 0); | 11040 | try string_bytes.append(gpa, 0); |
| 11047 | return IndexSlice{ | 11041 | return IndexSlice{ |
| 11048 | .index = str_index, | 11042 | .index = str_index, |
| 11049 | .len = @as(u32, @intCast(key.len)), | 11043 | .len = @intCast(key.len), |
| 11050 | }; | 11044 | }; |
| 11051 | } | 11045 | } |
| 11052 | } | 11046 | } |
| ... | @@ -11083,15 +11077,15 @@ fn strLitNodeAsString(astgen: *AstGen, node: Ast.Node.Index) !IndexSlice { | ... | @@ -11083,15 +11077,15 @@ fn strLitNodeAsString(astgen: *AstGen, node: Ast.Node.Index) !IndexSlice { |
| 11083 | const len = string_bytes.items.len - str_index; | 11077 | const len = string_bytes.items.len - str_index; |
| 11084 | try string_bytes.append(gpa, 0); | 11078 | try string_bytes.append(gpa, 0); |
| 11085 | return IndexSlice{ | 11079 | return IndexSlice{ |
| 11086 | .index = @as(u32, @intCast(str_index)), | 11080 | .index = @intCast(str_index), |
| 11087 | .len = @as(u32, @intCast(len)), | 11081 | .len = @intCast(len), |
| 11088 | }; | 11082 | }; |
| 11089 | } | 11083 | } |
| 11090 | | 11084 | |
| 11091 | fn testNameString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !u32 { | 11085 | fn testNameString(astgen: *AstGen, str_lit_token: Ast.TokenIndex) !u32 { |
| 11092 | const gpa = astgen.gpa; | 11086 | const gpa = astgen.gpa; |
| 11093 | const string_bytes = &astgen.string_bytes; | 11087 | const string_bytes = &astgen.string_bytes; |
| 11094 | const str_index = @as(u32, @intCast(string_bytes.items.len)); | 11088 | const str_index: u32 = @intCast(string_bytes.items.len); |
| 11095 | const token_bytes = astgen.tree.tokenSlice(str_lit_token); | 11089 | const token_bytes = astgen.tree.tokenSlice(str_lit_token); |
| 11096 | try string_bytes.append(gpa, 0); // Indicates this is a test. | 11090 | try string_bytes.append(gpa, 0); // Indicates this is a test. |
| 11097 | try astgen.parseStrLit(str_lit_token, string_bytes, token_bytes, 0); | 11091 | try astgen.parseStrLit(str_lit_token, string_bytes, token_bytes, 0); |
| ... | @@ -11603,7 +11597,7 @@ const GenZir = struct { | ... | @@ -11603,7 +11597,7 @@ const GenZir = struct { |
| 11603 | const astgen = gz.astgen; | 11597 | const astgen = gz.astgen; |
| 11604 | const gpa = astgen.gpa; | 11598 | const gpa = astgen.gpa; |
| 11605 | const ret_ref = if (args.ret_ref == .void_type) .none else args.ret_ref; | 11599 | const ret_ref = if (args.ret_ref == .void_type) .none else args.ret_ref; |
| 11606 | const new_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 11600 | const new_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 11607 | | 11601 | |
| 11608 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); | 11602 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11609 | | 11603 | |
| ... | @@ -11621,8 +11615,8 @@ const GenZir = struct { | ... | @@ -11621,8 +11615,8 @@ const GenZir = struct { |
| 11621 | const block = node_datas[fn_decl].rhs; | 11615 | const block = node_datas[fn_decl].rhs; |
| 11622 | const rbrace_start = token_starts[tree.lastToken(block)]; | 11616 | const rbrace_start = token_starts[tree.lastToken(block)]; |
| 11623 | astgen.advanceSourceCursor(rbrace_start); | 11617 | astgen.advanceSourceCursor(rbrace_start); |
| 11624 | const rbrace_line = @as(u32, @intCast(astgen.source_line - gz.decl_line)); | 11618 | const rbrace_line: u32 = @intCast(astgen.source_line - gz.decl_line); |
| 11625 | const rbrace_column = @as(u32, @intCast(astgen.source_column)); | 11619 | const rbrace_column: u32 = @intCast(astgen.source_column); |
| 11626 | | 11620 | |
| 11627 | const columns = args.lbrace_column | (rbrace_column << 16); | 11621 | const columns = args.lbrace_column | (rbrace_column << 16); |
| 11628 | src_locs_buffer[0] = args.lbrace_line; | 11622 | src_locs_buffer[0] = args.lbrace_line; |
| ... | @@ -11866,18 +11860,18 @@ const GenZir = struct { | ... | @@ -11866,18 +11860,18 @@ const GenZir = struct { |
| 11866 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.init)); | 11860 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.init)); |
| 11867 | } | 11861 | } |
| 11868 | | 11862 | |
| 11869 | const new_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 11863 | const new_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 11870 | astgen.instructions.appendAssumeCapacity(.{ | 11864 | astgen.instructions.appendAssumeCapacity(.{ |
| 11871 | .tag = .extended, | 11865 | .tag = .extended, |
| 11872 | .data = .{ .extended = .{ | 11866 | .data = .{ .extended = .{ |
| 11873 | .opcode = .variable, | 11867 | .opcode = .variable, |
| 11874 | .small = @as(u16, @bitCast(Zir.Inst.ExtendedVar.Small{ | 11868 | .small = @bitCast(Zir.Inst.ExtendedVar.Small{ |
| 11875 | .has_lib_name = args.lib_name != 0, | 11869 | .has_lib_name = args.lib_name != 0, |
| 11876 | .has_align = args.align_inst != .none, | 11870 | .has_align = args.align_inst != .none, |
| 11877 | .has_init = args.init != .none, | 11871 | .has_init = args.init != .none, |
| 11878 | .is_extern = args.is_extern, | 11872 | .is_extern = args.is_extern, |
| 11879 | .is_threadlocal = args.is_threadlocal, | 11873 | .is_threadlocal = args.is_threadlocal, |
| 11880 | })), | 11874 | }), |
| 11881 | .operand = payload_index, | 11875 | .operand = payload_index, |
| 11882 | } }, | 11876 | } }, |
| 11883 | }); | 11877 | }); |
| ... | @@ -11897,7 +11891,7 @@ const GenZir = struct { | ... | @@ -11897,7 +11891,7 @@ const GenZir = struct { |
| 11897 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 11891 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 11898 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 11892 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11899 | | 11893 | |
| 11900 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 11894 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 11901 | gz.astgen.instructions.appendAssumeCapacity(.{ | 11895 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 11902 | .tag = tag, | 11896 | .tag = tag, |
| 11903 | .data = .{ .bool_br = .{ | 11897 | .data = .{ .bool_br = .{ |
| ... | @@ -11923,12 +11917,12 @@ const GenZir = struct { | ... | @@ -11923,12 +11917,12 @@ const GenZir = struct { |
| 11923 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); | 11917 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11924 | try astgen.string_bytes.ensureUnusedCapacity(gpa, @sizeOf(std.math.big.Limb) * limbs.len); | 11918 | try astgen.string_bytes.ensureUnusedCapacity(gpa, @sizeOf(std.math.big.Limb) * limbs.len); |
| 11925 | | 11919 | |
| 11926 | const new_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 11920 | const new_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 11927 | astgen.instructions.appendAssumeCapacity(.{ | 11921 | astgen.instructions.appendAssumeCapacity(.{ |
| 11928 | .tag = .int_big, | 11922 | .tag = .int_big, |
| 11929 | .data = .{ .str = .{ | 11923 | .data = .{ .str = .{ |
| 11930 | .start = @as(u32, @intCast(astgen.string_bytes.items.len)), | 11924 | .start = @intCast(astgen.string_bytes.items.len), |
| 11931 | .len = @as(u32, @intCast(limbs.len)), | 11925 | .len = @intCast(limbs.len), |
| 11932 | } }, | 11926 | } }, |
| 11933 | }); | 11927 | }); |
| 11934 | gz.instructions.appendAssumeCapacity(new_index); | 11928 | gz.instructions.appendAssumeCapacity(new_index); |
| ... | @@ -11968,7 +11962,7 @@ const GenZir = struct { | ... | @@ -11968,7 +11962,7 @@ const GenZir = struct { |
| 11968 | src_node: Ast.Node.Index, | 11962 | src_node: Ast.Node.Index, |
| 11969 | ) !Zir.Inst.Index { | 11963 | ) !Zir.Inst.Index { |
| 11970 | assert(operand != .none); | 11964 | assert(operand != .none); |
| 11971 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 11965 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 11972 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ | 11966 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ |
| 11973 | .tag = tag, | 11967 | .tag = tag, |
| 11974 | .data = .{ .un_node = .{ | 11968 | .data = .{ .un_node = .{ |
| ... | @@ -11991,7 +11985,7 @@ const GenZir = struct { | ... | @@ -11991,7 +11985,7 @@ const GenZir = struct { |
| 11991 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 11985 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 11992 | | 11986 | |
| 11993 | const payload_index = try gz.astgen.addExtra(extra); | 11987 | const payload_index = try gz.astgen.addExtra(extra); |
| 11994 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 11988 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 11995 | gz.astgen.instructions.appendAssumeCapacity(.{ | 11989 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 11996 | .tag = tag, | 11990 | .tag = tag, |
| 11997 | .data = .{ .pl_node = .{ | 11991 | .data = .{ .pl_node = .{ |
| ... | @@ -12043,12 +12037,12 @@ const GenZir = struct { | ... | @@ -12043,12 +12037,12 @@ const GenZir = struct { |
| 12043 | const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.Param{ | 12037 | const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.Param{ |
| 12044 | .name = name, | 12038 | .name = name, |
| 12045 | .doc_comment = doc_comment_index, | 12039 | .doc_comment = doc_comment_index, |
| 12046 | .body_len = @as(u32, @intCast(body_len)), | 12040 | .body_len = @intCast(body_len), |
| 12047 | }); | 12041 | }); |
| 12048 | gz.astgen.appendBodyWithFixups(param_body); | 12042 | gz.astgen.appendBodyWithFixups(param_body); |
| 12049 | param_gz.unstack(); | 12043 | param_gz.unstack(); |
| 12050 | | 12044 | |
| 12051 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 12045 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 12052 | gz.astgen.instructions.appendAssumeCapacity(.{ | 12046 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 12053 | .tag = tag, | 12047 | .tag = tag, |
| 12054 | .data = .{ .pl_tok = .{ | 12048 | .data = .{ .pl_tok = .{ |
| ... | @@ -12076,7 +12070,7 @@ const GenZir = struct { | ... | @@ -12076,7 +12070,7 @@ const GenZir = struct { |
| 12076 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 12070 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 12077 | | 12071 | |
| 12078 | const payload_index = try gz.astgen.addExtra(extra); | 12072 | const payload_index = try gz.astgen.addExtra(extra); |
| 12079 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 12073 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 12080 | gz.astgen.instructions.appendAssumeCapacity(.{ | 12074 | gz.astgen.instructions.appendAssumeCapacity(.{ |
| 12081 | .tag = .extended, | 12075 | .tag = .extended, |
| 12082 | .data = .{ .extended = .{ | 12076 | .data = .{ .extended = .{ |
| ... | @@ -12108,12 +12102,12 @@ const GenZir = struct { | ... | @@ -12108,12 +12102,12 @@ const GenZir = struct { |
| 12108 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.NodeMultiOp{ | 12102 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.NodeMultiOp{ |
| 12109 | .src_node = gz.nodeIndexToRelative(node), | 12103 | .src_node = gz.nodeIndexToRelative(node), |
| 12110 | }); | 12104 | }); |
| 12111 | const new_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 12105 | const new_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 12112 | astgen.instructions.appendAssumeCapacity(.{ | 12106 | astgen.instructions.appendAssumeCapacity(.{ |
| 12113 | .tag = .extended, | 12107 | .tag = .extended, |
| 12114 | .data = .{ .extended = .{ | 12108 | .data = .{ .extended = .{ |
| 12115 | .opcode = opcode, | 12109 | .opcode = opcode, |
| 12116 | .small = @as(u16, @intCast(operands.len)), | 12110 | .small = @intCast(operands.len), |
| 12117 | .operand = payload_index, | 12111 | .operand = payload_index, |
| 12118 | } }, | 12112 | } }, |
| 12119 | }); | 12113 | }); |
| ... | @@ -12133,12 +12127,12 @@ const GenZir = struct { | ... | @@ -12133,12 +12127,12 @@ const GenZir = struct { |
| 12133 | | 12127 | |
| 12134 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 12128 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 12135 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); | 12129 | try astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 12136 | const new_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 12130 | const new_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 12137 | astgen.instructions.appendAssumeCapacity(.{ | 12131 | astgen.instructions.appendAssumeCapacity(.{ |
| 12138 | .tag = .extended, | 12132 | .tag = .extended, |
| 12139 | .data = .{ .extended = .{ | 12133 | .data = .{ .extended = .{ |
| 12140 | .opcode = opcode, | 12134 | .opcode = opcode, |
| 12141 | .small = @as(u16, @intCast(trailing_len)), | 12135 | .small = @intCast(trailing_len), |
| 12142 | .operand = payload_index, | 12136 | .operand = payload_index, |
| 12143 | } }, | 12137 | } }, |
| 12144 | }); | 12138 | }); |
| ... | @@ -12171,7 +12165,7 @@ const GenZir = struct { | ... | @@ -12171,7 +12165,7 @@ const GenZir = struct { |
| 12171 | abs_tok_index: Ast.TokenIndex, | 12165 | abs_tok_index: Ast.TokenIndex, |
| 12172 | ) !Zir.Inst.Index { | 12166 | ) !Zir.Inst.Index { |
| 12173 | const astgen = gz.astgen; | 12167 | const astgen = gz.astgen; |
| 12174 | const new_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 12168 | const new_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 12175 | assert(operand != .none); | 12169 | assert(operand != .none); |
| 12176 | try astgen.instructions.append(astgen.gpa, .{ | 12170 | try astgen.instructions.append(astgen.gpa, .{ |
| 12177 | .tag = tag, | 12171 | .tag = tag, |
| ... | @@ -12399,7 +12393,7 @@ const GenZir = struct { | ... | @@ -12399,7 +12393,7 @@ const GenZir = struct { |
| 12399 | .data = .{ .extended = .{ | 12393 | .data = .{ .extended = .{ |
| 12400 | .opcode = opcode, | 12394 | .opcode = opcode, |
| 12401 | .small = undefined, | 12395 | .small = undefined, |
| 12402 | .operand = @as(u32, @bitCast(gz.nodeIndexToRelative(src_node))), | 12396 | .operand = @bitCast(gz.nodeIndexToRelative(src_node)), |
| 12403 | } }, | 12397 | } }, |
| 12404 | }); | 12398 | }); |
| 12405 | } | 12399 | } |
| ... | @@ -12423,8 +12417,8 @@ const GenZir = struct { | ... | @@ -12423,8 +12417,8 @@ const GenZir = struct { |
| 12423 | try astgen.extra.ensureUnusedCapacity( | 12417 | try astgen.extra.ensureUnusedCapacity( |
| 12424 | gpa, | 12418 | gpa, |
| 12425 | @typeInfo(Zir.Inst.AllocExtended).Struct.fields.len + | 12419 | @typeInfo(Zir.Inst.AllocExtended).Struct.fields.len + |
| 12426 | @as(usize, @intFromBool(args.type_inst != .none)) + | 12420 | @intFromBool(args.type_inst != .none) + |
| 12427 | @as(usize, @intFromBool(args.align_inst != .none)), | 12421 | @intFromBool(args.align_inst != .none), |
| 12428 | ); | 12422 | ); |
| 12429 | const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.AllocExtended{ | 12423 | const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.AllocExtended{ |
| 12430 | .src_node = gz.nodeIndexToRelative(args.node), | 12424 | .src_node = gz.nodeIndexToRelative(args.node), |
| ... | @@ -12442,7 +12436,7 @@ const GenZir = struct { | ... | @@ -12442,7 +12436,7 @@ const GenZir = struct { |
| 12442 | const is_comptime: u4 = @intFromBool(args.is_comptime); | 12436 | const is_comptime: u4 = @intFromBool(args.is_comptime); |
| 12443 | const small: u16 = has_type | (has_align << 1) | (is_const << 2) | (is_comptime << 3); | 12437 | const small: u16 = has_type | (has_align << 1) | (is_const << 2) | (is_comptime << 3); |
| 12444 | | 12438 | |
| 12445 | const new_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 12439 | const new_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 12446 | astgen.instructions.appendAssumeCapacity(.{ | 12440 | astgen.instructions.appendAssumeCapacity(.{ |
| 12447 | .tag = .extended, | 12441 | .tag = .extended, |
| 12448 | .data = .{ .extended = .{ | 12442 | .data = .{ .extended = .{ |
| ... | @@ -12501,7 +12495,7 @@ const GenZir = struct { | ... | @@ -12501,7 +12495,7 @@ const GenZir = struct { |
| 12501 | @as(u16, @intCast(args.clobbers.len << 10)) | | 12495 | @as(u16, @intCast(args.clobbers.len << 10)) | |
| 12502 | (@as(u16, @intFromBool(args.is_volatile)) << 15); | 12496 | (@as(u16, @intFromBool(args.is_volatile)) << 15); |
| 12503 | | 12497 | |
| 12504 | const new_index = @as(Zir.Inst.Index, @intCast(astgen.instructions.len)); | 12498 | const new_index: Zir.Inst.Index = @intCast(astgen.instructions.len); |
| 12505 | astgen.instructions.appendAssumeCapacity(.{ | 12499 | astgen.instructions.appendAssumeCapacity(.{ |
| 12506 | .tag = .extended, | 12500 | .tag = .extended, |
| 12507 | .data = .{ .extended = .{ | 12501 | .data = .{ .extended = .{ |
| ... | @@ -12518,7 +12512,7 @@ const GenZir = struct { | ... | @@ -12518,7 +12512,7 @@ const GenZir = struct { |
| 12518 | /// Does *not* append the block instruction to the scope. | 12512 | /// Does *not* append the block instruction to the scope. |
| 12519 | /// Leaves the `payload_index` field undefined. | 12513 | /// Leaves the `payload_index` field undefined. |
| 12520 | fn makeBlockInst(gz: *GenZir, tag: Zir.Inst.Tag, node: Ast.Node.Index) !Zir.Inst.Index { | 12514 | fn makeBlockInst(gz: *GenZir, tag: Zir.Inst.Tag, node: Ast.Node.Index) !Zir.Inst.Index { |
| 12521 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 12515 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 12522 | const gpa = gz.astgen.gpa; | 12516 | const gpa = gz.astgen.gpa; |
| 12523 | try gz.astgen.instructions.append(gpa, .{ | 12517 | try gz.astgen.instructions.append(gpa, .{ |
| 12524 | .tag = tag, | 12518 | .tag = tag, |
| ... | @@ -12535,7 +12529,7 @@ const GenZir = struct { | ... | @@ -12535,7 +12529,7 @@ const GenZir = struct { |
| 12535 | fn addCondBr(gz: *GenZir, tag: Zir.Inst.Tag, node: Ast.Node.Index) !Zir.Inst.Index { | 12529 | fn addCondBr(gz: *GenZir, tag: Zir.Inst.Tag, node: Ast.Node.Index) !Zir.Inst.Index { |
| 12536 | const gpa = gz.astgen.gpa; | 12530 | const gpa = gz.astgen.gpa; |
| 12537 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 12531 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 12538 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 12532 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 12539 | try gz.astgen.instructions.append(gpa, .{ | 12533 | try gz.astgen.instructions.append(gpa, .{ |
| 12540 | .tag = tag, | 12534 | .tag = tag, |
| 12541 | .data = .{ .pl_node = .{ | 12535 | .data = .{ .pl_node = .{ |
| ... | @@ -12562,11 +12556,11 @@ const GenZir = struct { | ... | @@ -12562,11 +12556,11 @@ const GenZir = struct { |
| 12562 | const gpa = astgen.gpa; | 12556 | const gpa = astgen.gpa; |
| 12563 | | 12557 | |
| 12564 | try astgen.extra.ensureUnusedCapacity(gpa, 6); | 12558 | try astgen.extra.ensureUnusedCapacity(gpa, 6); |
| 12565 | const payload_index = @as(u32, @intCast(astgen.extra.items.len)); | 12559 | const payload_index: u32 = @intCast(astgen.extra.items.len); |
| 12566 | | 12560 | |
| 12567 | if (args.src_node != 0) { | 12561 | if (args.src_node != 0) { |
| 12568 | const node_offset = gz.nodeIndexToRelative(args.src_node); | 12562 | const node_offset = gz.nodeIndexToRelative(args.src_node); |
| 12569 | astgen.extra.appendAssumeCapacity(@as(u32, @bitCast(node_offset))); | 12563 | astgen.extra.appendAssumeCapacity(@bitCast(node_offset)); |
| 12570 | } | 12564 | } |
| 12571 | if (args.fields_len != 0) { | 12565 | if (args.fields_len != 0) { |
| 12572 | astgen.extra.appendAssumeCapacity(args.fields_len); | 12566 | astgen.extra.appendAssumeCapacity(args.fields_len); |
| ... | @@ -12584,7 +12578,7 @@ const GenZir = struct { | ... | @@ -12584,7 +12578,7 @@ const GenZir = struct { |
| 12584 | .tag = .extended, | 12578 | .tag = .extended, |
| 12585 | .data = .{ .extended = .{ | 12579 | .data = .{ .extended = .{ |
| 12586 | .opcode = .struct_decl, | 12580 | .opcode = .struct_decl, |
| 12587 | .small = @as(u16, @bitCast(Zir.Inst.StructDecl.Small{ | 12581 | .small = @bitCast(Zir.Inst.StructDecl.Small{ |
| 12588 | .has_src_node = args.src_node != 0, | 12582 | .has_src_node = args.src_node != 0, |
| 12589 | .has_fields_len = args.fields_len != 0, | 12583 | .has_fields_len = args.fields_len != 0, |
| 12590 | .has_decls_len = args.decls_len != 0, | 12584 | .has_decls_len = args.decls_len != 0, |
| ... | @@ -12594,7 +12588,7 @@ const GenZir = struct { | ... | @@ -12594,7 +12588,7 @@ const GenZir = struct { |
| 12594 | .is_tuple = args.is_tuple, | 12588 | .is_tuple = args.is_tuple, |
| 12595 | .name_strategy = gz.anon_name_strategy, | 12589 | .name_strategy = gz.anon_name_strategy, |
| 12596 | .layout = args.layout, | 12590 | .layout = args.layout, |
| 12597 | })), | 12591 | }), |
| 12598 | .operand = payload_index, | 12592 | .operand = payload_index, |
| 12599 | } }, | 12593 | } }, |
| 12600 | }); | 12594 | }); |
| ... | @@ -12613,11 +12607,11 @@ const GenZir = struct { | ... | @@ -12613,11 +12607,11 @@ const GenZir = struct { |
| 12613 | const gpa = astgen.gpa; | 12607 | const gpa = astgen.gpa; |
| 12614 | | 12608 | |
| 12615 | try astgen.extra.ensureUnusedCapacity(gpa, 5); | 12609 | try astgen.extra.ensureUnusedCapacity(gpa, 5); |
| 12616 | const payload_index = @as(u32, @intCast(astgen.extra.items.len)); | 12610 | const payload_index: u32 = @intCast(astgen.extra.items.len); |
| 12617 | | 12611 | |
| 12618 | if (args.src_node != 0) { | 12612 | if (args.src_node != 0) { |
| 12619 | const node_offset = gz.nodeIndexToRelative(args.src_node); | 12613 | const node_offset = gz.nodeIndexToRelative(args.src_node); |
| 12620 | astgen.extra.appendAssumeCapacity(@as(u32, @bitCast(node_offset))); | 12614 | astgen.extra.appendAssumeCapacity(@bitCast(node_offset)); |
| 12621 | } | 12615 | } |
| 12622 | if (args.tag_type != .none) { | 12616 | if (args.tag_type != .none) { |
| 12623 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.tag_type)); | 12617 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.tag_type)); |
| ... | @@ -12635,7 +12629,7 @@ const GenZir = struct { | ... | @@ -12635,7 +12629,7 @@ const GenZir = struct { |
| 12635 | .tag = .extended, | 12629 | .tag = .extended, |
| 12636 | .data = .{ .extended = .{ | 12630 | .data = .{ .extended = .{ |
| 12637 | .opcode = .union_decl, | 12631 | .opcode = .union_decl, |
| 12638 | .small = @as(u16, @bitCast(Zir.Inst.UnionDecl.Small{ | 12632 | .small = @bitCast(Zir.Inst.UnionDecl.Small{ |
| 12639 | .has_src_node = args.src_node != 0, | 12633 | .has_src_node = args.src_node != 0, |
| 12640 | .has_tag_type = args.tag_type != .none, | 12634 | .has_tag_type = args.tag_type != .none, |
| 12641 | .has_body_len = args.body_len != 0, | 12635 | .has_body_len = args.body_len != 0, |
| ... | @@ -12644,7 +12638,7 @@ const GenZir = struct { | ... | @@ -12644,7 +12638,7 @@ const GenZir = struct { |
| 12644 | .name_strategy = gz.anon_name_strategy, | 12638 | .name_strategy = gz.anon_name_strategy, |
| 12645 | .layout = args.layout, | 12639 | .layout = args.layout, |
| 12646 | .auto_enum_tag = args.auto_enum_tag, | 12640 | .auto_enum_tag = args.auto_enum_tag, |
| 12647 | })), | 12641 | }), |
| 12648 | .operand = payload_index, | 12642 | .operand = payload_index, |
| 12649 | } }, | 12643 | } }, |
| 12650 | }); | 12644 | }); |
| ... | @@ -12662,11 +12656,11 @@ const GenZir = struct { | ... | @@ -12662,11 +12656,11 @@ const GenZir = struct { |
| 12662 | const gpa = astgen.gpa; | 12656 | const gpa = astgen.gpa; |
| 12663 | | 12657 | |
| 12664 | try astgen.extra.ensureUnusedCapacity(gpa, 5); | 12658 | try astgen.extra.ensureUnusedCapacity(gpa, 5); |
| 12665 | const payload_index = @as(u32, @intCast(astgen.extra.items.len)); | 12659 | const payload_index: u32 = @intCast(astgen.extra.items.len); |
| 12666 | | 12660 | |
| 12667 | if (args.src_node != 0) { | 12661 | if (args.src_node != 0) { |
| 12668 | const node_offset = gz.nodeIndexToRelative(args.src_node); | 12662 | const node_offset = gz.nodeIndexToRelative(args.src_node); |
| 12669 | astgen.extra.appendAssumeCapacity(@as(u32, @bitCast(node_offset))); | 12663 | astgen.extra.appendAssumeCapacity(@bitCast(node_offset)); |
| 12670 | } | 12664 | } |
| 12671 | if (args.tag_type != .none) { | 12665 | if (args.tag_type != .none) { |
| 12672 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.tag_type)); | 12666 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.tag_type)); |
| ... | @@ -12684,7 +12678,7 @@ const GenZir = struct { | ... | @@ -12684,7 +12678,7 @@ const GenZir = struct { |
| 12684 | .tag = .extended, | 12678 | .tag = .extended, |
| 12685 | .data = .{ .extended = .{ | 12679 | .data = .{ .extended = .{ |
| 12686 | .opcode = .enum_decl, | 12680 | .opcode = .enum_decl, |
| 12687 | .small = @as(u16, @bitCast(Zir.Inst.EnumDecl.Small{ | 12681 | .small = @bitCast(Zir.Inst.EnumDecl.Small{ |
| 12688 | .has_src_node = args.src_node != 0, | 12682 | .has_src_node = args.src_node != 0, |
| 12689 | .has_tag_type = args.tag_type != .none, | 12683 | .has_tag_type = args.tag_type != .none, |
| 12690 | .has_body_len = args.body_len != 0, | 12684 | .has_body_len = args.body_len != 0, |
| ... | @@ -12692,7 +12686,7 @@ const GenZir = struct { | ... | @@ -12692,7 +12686,7 @@ const GenZir = struct { |
| 12692 | .has_decls_len = args.decls_len != 0, | 12686 | .has_decls_len = args.decls_len != 0, |
| 12693 | .name_strategy = gz.anon_name_strategy, | 12687 | .name_strategy = gz.anon_name_strategy, |
| 12694 | .nonexhaustive = args.nonexhaustive, | 12688 | .nonexhaustive = args.nonexhaustive, |
| 12695 | })), | 12689 | }), |
| 12696 | .operand = payload_index, | 12690 | .operand = payload_index, |
| 12697 | } }, | 12691 | } }, |
| 12698 | }); | 12692 | }); |
| ... | @@ -12706,11 +12700,11 @@ const GenZir = struct { | ... | @@ -12706,11 +12700,11 @@ const GenZir = struct { |
| 12706 | const gpa = astgen.gpa; | 12700 | const gpa = astgen.gpa; |
| 12707 | | 12701 | |
| 12708 | try astgen.extra.ensureUnusedCapacity(gpa, 2); | 12702 | try astgen.extra.ensureUnusedCapacity(gpa, 2); |
| 12709 | const payload_index = @as(u32, @intCast(astgen.extra.items.len)); | 12703 | const payload_index: u32 = @intCast(astgen.extra.items.len); |
| 12710 | | 12704 | |
| 12711 | if (args.src_node != 0) { | 12705 | if (args.src_node != 0) { |
| 12712 | const node_offset = gz.nodeIndexToRelative(args.src_node); | 12706 | const node_offset = gz.nodeIndexToRelative(args.src_node); |
| 12713 | astgen.extra.appendAssumeCapacity(@as(u32, @bitCast(node_offset))); | 12707 | astgen.extra.appendAssumeCapacity(@bitCast(node_offset)); |
| 12714 | } | 12708 | } |
| 12715 | if (args.decls_len != 0) { | 12709 | if (args.decls_len != 0) { |
| 12716 | astgen.extra.appendAssumeCapacity(args.decls_len); | 12710 | astgen.extra.appendAssumeCapacity(args.decls_len); |
| ... | @@ -12719,11 +12713,11 @@ const GenZir = struct { | ... | @@ -12719,11 +12713,11 @@ const GenZir = struct { |
| 12719 | .tag = .extended, | 12713 | .tag = .extended, |
| 12720 | .data = .{ .extended = .{ | 12714 | .data = .{ .extended = .{ |
| 12721 | .opcode = .opaque_decl, | 12715 | .opcode = .opaque_decl, |
| 12722 | .small = @as(u16, @bitCast(Zir.Inst.OpaqueDecl.Small{ | 12716 | .small = @bitCast(Zir.Inst.OpaqueDecl.Small{ |
| 12723 | .has_src_node = args.src_node != 0, | 12717 | .has_src_node = args.src_node != 0, |
| 12724 | .has_decls_len = args.decls_len != 0, | 12718 | .has_decls_len = args.decls_len != 0, |
| 12725 | .name_strategy = gz.anon_name_strategy, | 12719 | .name_strategy = gz.anon_name_strategy, |
| 12726 | })), | 12720 | }), |
| 12727 | .operand = payload_index, | 12721 | .operand = payload_index, |
| 12728 | } }, | 12722 | } }, |
| 12729 | }); | 12723 | }); |
| ... | @@ -12738,7 +12732,7 @@ const GenZir = struct { | ... | @@ -12738,7 +12732,7 @@ const GenZir = struct { |
| 12738 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 12732 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 12739 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 12733 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 12740 | | 12734 | |
| 12741 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 12735 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 12742 | gz.astgen.instructions.appendAssumeCapacity(inst); | 12736 | gz.astgen.instructions.appendAssumeCapacity(inst); |
| 12743 | gz.instructions.appendAssumeCapacity(new_index); | 12737 | gz.instructions.appendAssumeCapacity(new_index); |
| 12744 | return new_index; | 12738 | return new_index; |
| ... | @@ -12749,7 +12743,7 @@ const GenZir = struct { | ... | @@ -12749,7 +12743,7 @@ const GenZir = struct { |
| 12749 | try gz.instructions.ensureUnusedCapacity(gpa, 1); | 12743 | try gz.instructions.ensureUnusedCapacity(gpa, 1); |
| 12750 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); | 12744 | try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1); |
| 12751 | | 12745 | |
| 12752 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 12746 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 12753 | gz.astgen.instructions.len += 1; | 12747 | gz.astgen.instructions.len += 1; |
| 12754 | gz.instructions.appendAssumeCapacity(new_index); | 12748 | gz.instructions.appendAssumeCapacity(new_index); |
| 12755 | return new_index; | 12749 | return new_index; |
| ... | @@ -12801,7 +12795,7 @@ const GenZir = struct { | ... | @@ -12801,7 +12795,7 @@ const GenZir = struct { |
| 12801 | return; | 12795 | return; |
| 12802 | } | 12796 | } |
| 12803 | | 12797 | |
| 12804 | const new_index = @as(Zir.Inst.Index, @intCast(gz.astgen.instructions.len)); | 12798 | const new_index: Zir.Inst.Index = @intCast(gz.astgen.instructions.len); |
| 12805 | try gz.astgen.instructions.append(gpa, .{ .tag = .dbg_block_end, .data = undefined }); | 12799 | try gz.astgen.instructions.append(gpa, .{ .tag = .dbg_block_end, .data = undefined }); |
| 12806 | try gz.instructions.append(gpa, new_index); | 12800 | try gz.instructions.append(gpa, new_index); |
| 12807 | } | 12801 | } |
| ... | @@ -12810,7 +12804,7 @@ const GenZir = struct { | ... | @@ -12810,7 +12804,7 @@ const GenZir = struct { |
| 12810 | /// This can only be for short-lived references; the memory becomes invalidated | 12804 | /// This can only be for short-lived references; the memory becomes invalidated |
| 12811 | /// when another string is added. | 12805 | /// when another string is added. |
| 12812 | fn nullTerminatedString(astgen: AstGen, index: usize) [*:0]const u8 { | 12806 | fn nullTerminatedString(astgen: AstGen, index: usize) [*:0]const u8 { |
| 12813 | return @as([*:0]const u8, @ptrCast(astgen.string_bytes.items.ptr)) + index; | 12807 | return @ptrCast(astgen.string_bytes.items[index..]); |
| 12814 | } | 12808 | } |
| 12815 | | 12809 | |
| 12816 | /// Local variables shadowing detection, including function parameters. | 12810 | /// Local variables shadowing detection, including function parameters. |
| ... | @@ -13089,7 +13083,7 @@ fn isInferred(astgen: *AstGen, ref: Zir.Inst.Ref) bool { | ... | @@ -13089,7 +13083,7 @@ fn isInferred(astgen: *AstGen, ref: Zir.Inst.Ref) bool { |
| 13089 | .extended => { | 13083 | .extended => { |
| 13090 | const zir_data = astgen.instructions.items(.data); | 13084 | const zir_data = astgen.instructions.items(.data); |
| 13091 | if (zir_data[inst].extended.opcode != .alloc) return false; | 13085 | if (zir_data[inst].extended.opcode != .alloc) return false; |
| 13092 | const small = @as(Zir.Inst.AllocExtended.Small, @bitCast(zir_data[inst].extended.small)); | 13086 | const small: Zir.Inst.AllocExtended.Small = @bitCast(zir_data[inst].extended.small); |
| 13093 | return !small.has_type; | 13087 | return !small.has_type; |
| 13094 | }, | 13088 | }, |
| 13095 | | 13089 | |
| ... | @@ -13133,7 +13127,7 @@ fn countBodyLenAfterFixups(astgen: *AstGen, body: []const Zir.Inst.Index) u32 { | ... | @@ -13133,7 +13127,7 @@ fn countBodyLenAfterFixups(astgen: *AstGen, body: []const Zir.Inst.Index) u32 { |
| 13133 | check_inst = ref_inst; | 13127 | check_inst = ref_inst; |
| 13134 | } | 13128 | } |
| 13135 | } | 13129 | } |
| 13136 | return @as(u32, @intCast(count)); | 13130 | return @intCast(count); |
| 13137 | } | 13131 | } |
| 13138 | | 13132 | |
| 13139 | fn emitDbgStmt(gz: *GenZir, lc: LineColumn) !void { | 13133 | fn emitDbgStmt(gz: *GenZir, lc: LineColumn) !void { |
| ... | @@ -13165,7 +13159,7 @@ fn lowerAstErrors(astgen: *AstGen) !void { | ... | @@ -13165,7 +13159,7 @@ fn lowerAstErrors(astgen: *AstGen) !void { |
| 13165 | | 13159 | |
| 13166 | if (token_tags[parse_err.token + @intFromBool(parse_err.token_is_prev)] == .invalid) { | 13160 | if (token_tags[parse_err.token + @intFromBool(parse_err.token_is_prev)] == .invalid) { |
| 13167 | const tok = parse_err.token + @intFromBool(parse_err.token_is_prev); | 13161 | const tok = parse_err.token + @intFromBool(parse_err.token_is_prev); |
| 13168 | const bad_off = @as(u32, @intCast(tree.tokenSlice(parse_err.token + @intFromBool(parse_err.token_is_prev)).len)); | 13162 | const bad_off: u32 = @intCast(tree.tokenSlice(parse_err.token + @intFromBool(parse_err.token_is_prev)).len); |
| 13169 | const byte_abs = token_starts[parse_err.token + @intFromBool(parse_err.token_is_prev)] + bad_off; | 13163 | const byte_abs = token_starts[parse_err.token + @intFromBool(parse_err.token_is_prev)] + bad_off; |
| 13170 | try notes.append(gpa, try astgen.errNoteTokOff(tok, bad_off, "invalid byte: '{'}'", .{ | 13164 | try notes.append(gpa, try astgen.errNoteTokOff(tok, bad_off, "invalid byte: '{'}'", .{ |
| 13171 | std.zig.fmtEscapes(tree.source[byte_abs..][0..1]), | 13165 | std.zig.fmtEscapes(tree.source[byte_abs..][0..1]), |