| ... | ... | @@ -773,6 +773,7 @@ fn walkInstruction( |
| 773 | 773 | }); |
| 774 | 774 | break :blk .{ .type = ptrTypeId }; |
| 775 | 775 | }; |
| 776 | |
| 776 | 777 | return DocData.WalkResult{ |
| 777 | 778 | .typeRef = tRef, |
| 778 | 779 | .expr = .{ .string = str }, |
| ... | ... | @@ -817,7 +818,6 @@ fn walkInstruction( |
| 817 | 818 | }, |
| 818 | 819 | .elem_type => { |
| 819 | 820 | const un_node = data[inst_index].un_node; |
| 820 | | std.debug.print("un_node: {}\n", .{un_node}); |
| 821 | 821 | |
| 822 | 822 | var operand: DocData.WalkResult = try self.walkRef( |
| 823 | 823 | file, |
| ... | ... | @@ -826,8 +826,6 @@ fn walkInstruction( |
| 826 | 826 | false, |
| 827 | 827 | ); |
| 828 | 828 | |
| 829 | | std.debug.print("operand: {}\n", .{operand}); |
| 830 | | |
| 831 | 829 | return DocData.WalkResult{ |
| 832 | 830 | .typeRef = .{ .type = operand.typeRef.?.type }, |
| 833 | 831 | .expr = .{ .type = operand.expr.type }, |
| ... | ... | @@ -853,14 +851,8 @@ fn walkInstruction( |
| 853 | 851 | const ptr = data[inst_index].ptr_type; |
| 854 | 852 | const extra = file.zir.extraData(Zir.Inst.PtrType, ptr.payload_index); |
| 855 | 853 | |
| 856 | | std.debug.print("ptr = {}\n", .{ptr}); |
| 857 | | std.debug.print("extra = {any}\n", .{extra}); |
| 858 | | |
| 859 | 854 | const sentinel: ?usize = if (ptr.flags.has_sentinel) 0 else null; |
| 860 | 855 | |
| 861 | | std.debug.print("sentinel = {} {d}\n", .{ ptr.flags.has_sentinel, sentinel }); |
| 862 | | std.debug.print("type = {d}\n", .{@enumToInt(Ref.type_type)}); |
| 863 | | |
| 864 | 856 | const type_slot_index = self.types.items.len; |
| 865 | 857 | const elem_type_ref = try self.walkRef( |
| 866 | 858 | file, |
| ... | ... | @@ -875,7 +867,6 @@ fn walkInstruction( |
| 875 | 867 | .sentinel = sentinel, |
| 876 | 868 | }, |
| 877 | 869 | }); |
| 878 | | std.debug.print("type = {d}\n", .{type_slot_index}); |
| 879 | 870 | return DocData.WalkResult{ |
| 880 | 871 | // .typeRef = .{ .type = type_slot_index }, |
| 881 | 872 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, |
| ... | ... | @@ -887,11 +878,6 @@ fn walkInstruction( |
| 887 | 878 | const len = try self.walkRef(file, parent_scope, bin.lhs, false); |
| 888 | 879 | const child = try self.walkRef(file, parent_scope, bin.rhs, false); |
| 889 | 880 | |
| 890 | | std.debug.print("AEHO\n", .{}); |
| 891 | | // std.debug.print("bin = {}\n", .{bin}); |
| 892 | | // std.debug.print("len = {}\n", .{len}); |
| 893 | | // std.debug.print("child = {}\n", .{child}); |
| 894 | | |
| 895 | 881 | const type_slot_index = self.types.items.len; |
| 896 | 882 | try self.types.append(self.arena, .{ |
| 897 | 883 | .Array = .{ |
| ... | ... | @@ -899,6 +885,7 @@ fn walkInstruction( |
| 899 | 885 | .child = child.expr, |
| 900 | 886 | }, |
| 901 | 887 | }); |
| 888 | |
| 902 | 889 | return DocData.WalkResult{ |
| 903 | 890 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, |
| 904 | 891 | .expr = .{ .type = type_slot_index }, |
| ... | ... | @@ -908,7 +895,7 @@ fn walkInstruction( |
| 908 | 895 | const pl_node = data[inst_index].pl_node; |
| 909 | 896 | const extra = file.zir.extraData(Zir.Inst.ArrayTypeSentinel, pl_node.payload_index); |
| 910 | 897 | const len = try self.walkRef(file, parent_scope, extra.data.len, false); |
| 911 | | const sentinel = try self.walkRef(file, parent_scope, extra.data.sentinel, false); |
| 898 | // const sentinel = try self.walkRef(file, parent_scope, extra.data.sentinel, false); |
| 912 | 899 | const elem_type = try self.walkRef(file, parent_scope, extra.data.elem_type, false); |
| 913 | 900 | |
| 914 | 901 | const type_slot_index = self.types.items.len; |
| ... | ... | @@ -916,7 +903,7 @@ fn walkInstruction( |
| 916 | 903 | .Array = .{ |
| 917 | 904 | .len = len.expr, |
| 918 | 905 | .child = elem_type.expr, |
| 919 | | .sentinel = sentinel.expr.int.value, |
| 906 | .sentinel = 0, |
| 920 | 907 | }, |
| 921 | 908 | }); |
| 922 | 909 | return DocData.WalkResult{ |
| ... | ... | @@ -938,7 +925,6 @@ fn walkInstruction( |
| 938 | 925 | // we only ask to figure out type info for the first element |
| 939 | 926 | // as it will be used later on to find out the array type! |
| 940 | 927 | const wr = try self.walkRef(file, parent_scope, op, idx == 0); |
| 941 | | std.debug.print("wr: {any}\n", .{wr}); |
| 942 | 928 | |
| 943 | 929 | if (idx == 0) { |
| 944 | 930 | array_type = wr.typeRef; |
| ... | ... | @@ -979,7 +965,6 @@ fn walkInstruction( |
| 979 | 965 | // we only ask to figure out type info for the first element |
| 980 | 966 | // as it will be used later on to find out the array type! |
| 981 | 967 | const wr = try self.walkRef(file, parent_scope, op, idx == 0); |
| 982 | | std.debug.print("wr: {any}\n", .{wr}); |
| 983 | 968 | if (idx == 0) { |
| 984 | 969 | array_type = wr.typeRef; |
| 985 | 970 | } |
| ... | ... | @@ -990,8 +975,6 @@ fn walkInstruction( |
| 990 | 975 | array_data[idx] = wr.expr.as.exprArg; |
| 991 | 976 | } |
| 992 | 977 | |
| 993 | | // std.debug.print("array: {any}\n", .{array_data}); |
| 994 | | |
| 995 | 978 | const type_slot_index = self.types.items.len; |
| 996 | 979 | try self.types.append(self.arena, .{ |
| 997 | 980 | .Array = .{ .len = .{ |
| ... | ... | @@ -1016,20 +999,15 @@ fn walkInstruction( |
| 1016 | 999 | // TODO: make sure that you want the array to be fully normalized for real |
| 1017 | 1000 | // then update this code to conform to your choice. |
| 1018 | 1001 | |
| 1019 | | // std.debug.print("extra: {}\n", .{extra}); |
| 1020 | | // std.debug.print("operands: {any}\n", .{operands}); |
| 1021 | | |
| 1022 | 1002 | var array_type: ?DocData.Expr = null; |
| 1023 | 1003 | for (operands) |op, idx| { |
| 1024 | 1004 | // we only ask to figure out type info for the first element |
| 1025 | 1005 | // as it will be used later on to find out the array type! |
| 1026 | 1006 | const wr = try self.walkRef(file, parent_scope, op, idx == 0); |
| 1027 | | // std.debug.print("wr: {any}\n", .{wr}); |
| 1028 | 1007 | |
| 1029 | 1008 | if (idx == 0) { |
| 1030 | 1009 | array_type = wr.typeRef; |
| 1031 | 1010 | } |
| 1032 | | // std.debug.print("type: {}\n", .{@intToEnum(Ref, wr.typeRef.?.type)}); |
| 1033 | 1011 | |
| 1034 | 1012 | // create an untion to hold more than one type |
| 1035 | 1013 | switch (@intToEnum(Ref, wr.typeRef.?.type)) { |
| ... | ... | @@ -1044,8 +1022,6 @@ fn walkInstruction( |
| 1044 | 1022 | } |
| 1045 | 1023 | } |
| 1046 | 1024 | |
| 1047 | | // std.debug.print("array: {any}\n", .{array_data}); |
| 1048 | | |
| 1049 | 1025 | const type_slot_index = self.types.items.len; |
| 1050 | 1026 | try self.types.append(self.arena, .{ |
| 1051 | 1027 | .Array = .{ |
| ... | ... | @@ -1064,20 +1040,6 @@ fn walkInstruction( |
| 1064 | 1040 | .expr = .{ .array = array_data }, |
| 1065 | 1041 | }; |
| 1066 | 1042 | }, |
| 1067 | | // .validate_array_init_ty => { |
| 1068 | | // const un_node = data[inst_index].un_node; |
| 1069 | | // var operand: DocData.WalkResult = try self.walkRef( |
| 1070 | | // file, |
| 1071 | | // parent_scope, |
| 1072 | | // un_node.operand, |
| 1073 | | // need_type, |
| 1074 | | // ); |
| 1075 | | // |
| 1076 | | // std.debug.print("validate _ array => {}\n", .{un_node}); |
| 1077 | | // std.debug.print("operand = {}\n", .{operand}); |
| 1078 | | // |
| 1079 | | // return operand; |
| 1080 | | // }, |
| 1081 | 1043 | .float => { |
| 1082 | 1044 | const float = data[inst_index].float; |
| 1083 | 1045 | return DocData.WalkResult{ |