| ... | ... | @@ -71,7 +71,7 @@ fn lowerExprAnonResTy(self: *LowerZon, node: Zoir.Node.Index) CompileError!Inter |
| 71 | 71 | const gpa = comp.gpa; |
| 72 | 72 | const io = comp.io; |
| 73 | 73 | const ip = &pt.zcu.intern_pool; |
| 74 | | switch (node.get(self.file.zoir.?)) { |
| 74 | switch (node.get(&self.file.zoir.?)) { |
| 75 | 75 | .true => return .bool_true, |
| 76 | 76 | .false => return .bool_false, |
| 77 | 77 | .null => return .null_value, |
| ... | ... | @@ -101,7 +101,7 @@ fn lowerExprAnonResTy(self: *LowerZon, node: Zoir.Node.Index) CompileError!Inter |
| 101 | 101 | gpa, |
| 102 | 102 | io, |
| 103 | 103 | pt.tid, |
| 104 | | val.get(self.file.zoir.?), |
| 104 | val.get(&self.file.zoir.?), |
| 105 | 105 | .no_embedded_nulls, |
| 106 | 106 | ), |
| 107 | 107 | }), |
| ... | ... | @@ -174,7 +174,7 @@ fn lowerExprAnonResTy(self: *LowerZon, node: Zoir.Node.Index) CompileError!Inter |
| 174 | 174 | gpa, |
| 175 | 175 | io, |
| 176 | 176 | pt.tid, |
| 177 | | zoir_name.get(self.file.zoir.?), |
| 177 | zoir_name.get(&self.file.zoir.?), |
| 178 | 178 | .no_embedded_nulls, |
| 179 | 179 | ); |
| 180 | 180 | field_ty.* = ip.typeOf(field_val); |
| ... | ... | @@ -312,7 +312,7 @@ fn checkTypeInner( |
| 312 | 312 | fn nodeSrc(self: *LowerZon, node: Zoir.Node.Index) LazySrcLoc { |
| 313 | 313 | return .{ |
| 314 | 314 | .base_node_inst = self.base_node_inst, |
| 315 | | .offset = .{ .node_abs = node.getAstNode(self.file.zoir.?) }, |
| 315 | .offset = .{ .node_abs = node.getAstNode(&self.file.zoir.?) }, |
| 316 | 316 | }; |
| 317 | 317 | } |
| 318 | 318 | |
| ... | ... | @@ -363,7 +363,7 @@ fn lowerExprKnownResTyInner( |
| 363 | 363 | .optional => return pt.intern(.{ |
| 364 | 364 | .opt = .{ |
| 365 | 365 | .ty = res_ty.toIntern(), |
| 366 | | .val = if (node.get(self.file.zoir.?) == .null) b: { |
| 366 | .val = if (node.get(&self.file.zoir.?) == .null) b: { |
| 367 | 367 | break :b .none; |
| 368 | 368 | } else b: { |
| 369 | 369 | const child_type = res_ty.optionalChild(pt.zcu); |
| ... | ... | @@ -418,7 +418,7 @@ fn lowerExprKnownResTyInner( |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | fn lowerBool(self: *LowerZon, node: Zoir.Node.Index) !InternPool.Index { |
| 421 | | return switch (node.get(self.file.zoir.?)) { |
| 421 | return switch (node.get(&self.file.zoir.?)) { |
| 422 | 422 | .true => .bool_true, |
| 423 | 423 | .false => .bool_false, |
| 424 | 424 | else => return error.WrongType, |
| ... | ... | @@ -431,7 +431,7 @@ fn lowerInt( |
| 431 | 431 | res_ty: Type, |
| 432 | 432 | ) !InternPool.Index { |
| 433 | 433 | @setFloatMode(.strict); |
| 434 | | return switch (node.get(self.file.zoir.?)) { |
| 434 | return switch (node.get(&self.file.zoir.?)) { |
| 435 | 435 | .int_literal => |int| switch (int) { |
| 436 | 436 | .small => |val| { |
| 437 | 437 | const rhs: i32 = val; |
| ... | ... | @@ -555,7 +555,7 @@ fn lowerFloat( |
| 555 | 555 | res_ty: Type, |
| 556 | 556 | ) !InternPool.Index { |
| 557 | 557 | @setFloatMode(.strict); |
| 558 | | const value = switch (node.get(self.file.zoir.?)) { |
| 558 | const value = switch (node.get(&self.file.zoir.?)) { |
| 559 | 559 | .int_literal => |int| switch (int) { |
| 560 | 560 | .small => |val| try self.sema.pt.floatValue(res_ty, @as(f128, @floatFromInt(val))), |
| 561 | 561 | .big => |val| try self.sema.pt.floatValue(res_ty, val.toFloat(f128, .nearest_even)[0]), |
| ... | ... | @@ -592,7 +592,7 @@ fn lowerFloat( |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | fn lowerNull(self: *LowerZon, node: Zoir.Node.Index) !InternPool.Index { |
| 595 | | switch (node.get(self.file.zoir.?)) { |
| 595 | switch (node.get(&self.file.zoir.?)) { |
| 596 | 596 | .null => return .null_value, |
| 597 | 597 | else => return error.WrongType, |
| 598 | 598 | } |
| ... | ... | @@ -600,7 +600,7 @@ fn lowerNull(self: *LowerZon, node: Zoir.Node.Index) !InternPool.Index { |
| 600 | 600 | |
| 601 | 601 | fn lowerArray(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool.Index { |
| 602 | 602 | const array_info = res_ty.arrayInfo(self.sema.pt.zcu); |
| 603 | | const nodes: Zoir.Node.Index.Range = switch (node.get(self.file.zoir.?)) { |
| 603 | const nodes: Zoir.Node.Index.Range = switch (node.get(&self.file.zoir.?)) { |
| 604 | 604 | .array_literal => |nodes| nodes, |
| 605 | 605 | .empty_literal => .{ .start = node, .len = 0 }, |
| 606 | 606 | else => return error.WrongType, |
| ... | ... | @@ -633,13 +633,13 @@ fn lowerEnum(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool.I |
| 633 | 633 | const io = comp.io; |
| 634 | 634 | const ip = &pt.zcu.intern_pool; |
| 635 | 635 | try self.sema.ensureLayoutResolved(res_ty, self.import_loc, .init); |
| 636 | | switch (node.get(self.file.zoir.?)) { |
| 636 | switch (node.get(&self.file.zoir.?)) { |
| 637 | 637 | .enum_literal => |field_name| { |
| 638 | 638 | const field_name_interned = try ip.getOrPutString( |
| 639 | 639 | gpa, |
| 640 | 640 | io, |
| 641 | 641 | self.sema.pt.tid, |
| 642 | | field_name.get(self.file.zoir.?), |
| 642 | field_name.get(&self.file.zoir.?), |
| 643 | 643 | .no_embedded_nulls, |
| 644 | 644 | ); |
| 645 | 645 | const field_index = res_ty.enumFieldIndex(field_name_interned, self.sema.pt.zcu) orelse { |
| ... | ... | @@ -648,7 +648,7 @@ fn lowerEnum(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool.I |
| 648 | 648 | "enum {f} has no member named '{f}'", |
| 649 | 649 | .{ |
| 650 | 650 | res_ty.fmt(self.sema.pt), |
| 651 | | std.zig.fmtId(field_name.get(self.file.zoir.?)), |
| 651 | std.zig.fmtId(field_name.get(&self.file.zoir.?)), |
| 652 | 652 | }, |
| 653 | 653 | ); |
| 654 | 654 | }; |
| ... | ... | @@ -667,13 +667,13 @@ fn lowerEnumLiteral(self: *LowerZon, node: Zoir.Node.Index) !InternPool.Index { |
| 667 | 667 | const gpa = comp.gpa; |
| 668 | 668 | const io = comp.io; |
| 669 | 669 | const ip = &pt.zcu.intern_pool; |
| 670 | | switch (node.get(self.file.zoir.?)) { |
| 670 | switch (node.get(&self.file.zoir.?)) { |
| 671 | 671 | .enum_literal => |field_name| { |
| 672 | 672 | const field_name_interned = try ip.getOrPutString( |
| 673 | 673 | gpa, |
| 674 | 674 | io, |
| 675 | 675 | self.sema.pt.tid, |
| 676 | | field_name.get(self.file.zoir.?), |
| 676 | field_name.get(&self.file.zoir.?), |
| 677 | 677 | .no_embedded_nulls, |
| 678 | 678 | ); |
| 679 | 679 | return self.sema.pt.intern(.{ .enum_literal = field_name_interned }); |
| ... | ... | @@ -696,7 +696,7 @@ fn lowerTuple(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool. |
| 696 | 696 | |
| 697 | 697 | const tuple_info = ip.indexToKey(res_ty.toIntern()).tuple_type; |
| 698 | 698 | |
| 699 | | const elem_nodes: Zoir.Node.Index.Range = switch (node.get(self.file.zoir.?)) { |
| 699 | const elem_nodes: Zoir.Node.Index.Range = switch (node.get(&self.file.zoir.?)) { |
| 700 | 700 | .array_literal => |nodes| nodes, |
| 701 | 701 | .empty_literal => .{ .start = node, .len = 0 }, |
| 702 | 702 | else => return error.WrongType, |
| ... | ... | @@ -720,7 +720,7 @@ fn lowerTuple(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool. |
| 720 | 720 | "index {} outside tuple of length {}", |
| 721 | 721 | .{ |
| 722 | 722 | elems.len, |
| 723 | | elem_nodes.at(@intCast(i)).getAstNode(self.file.zoir.?), |
| 723 | elem_nodes.at(@intCast(i)).getAstNode(&self.file.zoir.?), |
| 724 | 724 | }, |
| 725 | 725 | ); |
| 726 | 726 | } |
| ... | ... | @@ -760,7 +760,7 @@ fn lowerStruct(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool |
| 760 | 760 | try self.sema.ensureStructDefaultsResolved(res_ty, self.import_loc); |
| 761 | 761 | const struct_info = self.sema.pt.zcu.typeToStruct(res_ty).?; |
| 762 | 762 | |
| 763 | | const fields: @FieldType(Zoir.Node, "struct_literal") = switch (node.get(self.file.zoir.?)) { |
| 763 | const fields: @FieldType(Zoir.Node, "struct_literal") = switch (node.get(&self.file.zoir.?)) { |
| 764 | 764 | .struct_literal => |fields| fields, |
| 765 | 765 | .empty_literal => .{ .names = &.{}, .vals = .{ .start = node, .len = 0 } }, |
| 766 | 766 | else => return error.WrongType, |
| ... | ... | @@ -780,7 +780,7 @@ fn lowerStruct(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool |
| 780 | 780 | gpa, |
| 781 | 781 | io, |
| 782 | 782 | self.sema.pt.tid, |
| 783 | | fields.names[i].get(self.file.zoir.?), |
| 783 | fields.names[i].get(&self.file.zoir.?), |
| 784 | 784 | .no_embedded_nulls, |
| 785 | 785 | ); |
| 786 | 786 | const field_node = fields.vals.at(@intCast(i)); |
| ... | ... | @@ -844,7 +844,7 @@ fn lowerSlice(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool. |
| 844 | 844 | const string_alignment = ptr_info.flags.alignment == .none or ptr_info.flags.alignment == .@"1"; |
| 845 | 845 | const string_sentinel = ptr_info.sentinel == .none or ptr_info.sentinel == .zero_u8; |
| 846 | 846 | if (string_alignment and ptr_info.child == .u8_type and string_sentinel) { |
| 847 | | switch (node.get(self.file.zoir.?)) { |
| 847 | switch (node.get(&self.file.zoir.?)) { |
| 848 | 848 | .string_literal => |val| { |
| 849 | 849 | const ip_str = try ip.getOrPutString(gpa, io, self.sema.pt.tid, val, .maybe_embedded_nulls); |
| 850 | 850 | const str_ref = try self.sema.addStrLit(ip_str, val.len); |
| ... | ... | @@ -860,7 +860,7 @@ fn lowerSlice(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool. |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | // Slice literals |
| 863 | | const elem_nodes: Zoir.Node.Index.Range = switch (node.get(self.file.zoir.?)) { |
| 863 | const elem_nodes: Zoir.Node.Index.Range = switch (node.get(&self.file.zoir.?)) { |
| 864 | 864 | .array_literal => |nodes| nodes, |
| 865 | 865 | .empty_literal => .{ .start = node, .len = 0 }, |
| 866 | 866 | else => return error.WrongType, |
| ... | ... | @@ -927,19 +927,19 @@ fn lowerUnion(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool. |
| 927 | 927 | const union_info = pt.zcu.typeToUnion(res_ty).?; |
| 928 | 928 | const enum_tag_info = ip.loadEnumType(union_info.enum_tag_type); |
| 929 | 929 | |
| 930 | | const field_name, const maybe_field_node = switch (node.get(self.file.zoir.?)) { |
| 930 | const field_name, const maybe_field_node = switch (node.get(&self.file.zoir.?)) { |
| 931 | 931 | .enum_literal => |name| b: { |
| 932 | 932 | const field_name = try ip.getOrPutString( |
| 933 | 933 | gpa, |
| 934 | 934 | io, |
| 935 | 935 | self.sema.pt.tid, |
| 936 | | name.get(self.file.zoir.?), |
| 936 | name.get(&self.file.zoir.?), |
| 937 | 937 | .no_embedded_nulls, |
| 938 | 938 | ); |
| 939 | 939 | break :b .{ field_name, null }; |
| 940 | 940 | }, |
| 941 | 941 | .struct_literal => b: { |
| 942 | | const fields: @FieldType(Zoir.Node, "struct_literal") = switch (node.get(self.file.zoir.?)) { |
| 942 | const fields: @FieldType(Zoir.Node, "struct_literal") = switch (node.get(&self.file.zoir.?)) { |
| 943 | 943 | .struct_literal => |fields| fields, |
| 944 | 944 | else => return self.fail(node, "expected type '{f}'", .{res_ty.fmt(self.sema.pt)}), |
| 945 | 945 | }; |
| ... | ... | @@ -950,7 +950,7 @@ fn lowerUnion(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool. |
| 950 | 950 | gpa, |
| 951 | 951 | io, |
| 952 | 952 | self.sema.pt.tid, |
| 953 | | fields.names[0].get(self.file.zoir.?), |
| 953 | fields.names[0].get(&self.file.zoir.?), |
| 954 | 954 | .no_embedded_nulls, |
| 955 | 955 | ); |
| 956 | 956 | break :b .{ field_name, fields.vals.at(0) }; |
| ... | ... | @@ -986,7 +986,7 @@ fn lowerVector(self: *LowerZon, node: Zoir.Node.Index, res_ty: Type) !InternPool |
| 986 | 986 | |
| 987 | 987 | const vector_info = ip.indexToKey(res_ty.toIntern()).vector_type; |
| 988 | 988 | |
| 989 | | const elem_nodes: Zoir.Node.Index.Range = switch (node.get(self.file.zoir.?)) { |
| 989 | const elem_nodes: Zoir.Node.Index.Range = switch (node.get(&self.file.zoir.?)) { |
| 990 | 990 | .array_literal => |nodes| nodes, |
| 991 | 991 | .empty_literal => .{ .start = node, .len = 0 }, |
| 992 | 992 | else => return error.WrongType, |