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