| ... | ... | @@ -90,7 +90,9 @@ pub const Type = extern union { |
| 90 | 90 | |
| 91 | 91 | .anyframe_T, .@"anyframe" => return .AnyFrame, |
| 92 | 92 | |
| 93 | | .empty_struct => return .Struct, |
| 93 | .@"struct", .empty_struct => return .Struct, |
| 94 | .@"enum" => return .Enum, |
| 95 | .@"union" => return .Union, |
| 94 | 96 | } |
| 95 | 97 | } |
| 96 | 98 | |
| ... | ... | @@ -442,6 +444,11 @@ pub const Type = extern union { |
| 442 | 444 | .error_set => return self.copyPayloadShallow(allocator, Payload.ErrorSet), |
| 443 | 445 | .error_set_single => return self.copyPayloadShallow(allocator, Payload.ErrorSetSingle), |
| 444 | 446 | .empty_struct => return self.copyPayloadShallow(allocator, Payload.EmptyStruct), |
| 447 | |
| 448 | // memory managed by the decl |
| 449 | .@"enum" => return self, |
| 450 | .@"struct" => return self, |
| 451 | .@"union" => return self, |
| 445 | 452 | } |
| 446 | 453 | } |
| 447 | 454 | |
| ... | ... | @@ -673,6 +680,10 @@ pub const Type = extern union { |
| 673 | 680 | const payload = @fieldParentPtr(Payload.ErrorSetSingle, "base", ty.ptr_otherwise); |
| 674 | 681 | return out_stream.print("error{{{}}}", .{payload.name}); |
| 675 | 682 | }, |
| 683 | // TODO improve |
| 684 | .@"enum" => return out_stream.writeAll("enum {}"), |
| 685 | .@"struct" => return out_stream.writeAll("struct {}"), |
| 686 | .@"union" => return out_stream.writeAll("union {}"), |
| 676 | 687 | } |
| 677 | 688 | unreachable; |
| 678 | 689 | } |
| ... | ... | @@ -784,6 +795,10 @@ pub const Type = extern union { |
| 784 | 795 | return payload.error_set.hasCodeGenBits() or payload.payload.hasCodeGenBits(); |
| 785 | 796 | }, |
| 786 | 797 | |
| 798 | .@"enum" => @panic("TODO"), |
| 799 | .@"struct" => @panic("TODO"), |
| 800 | .@"union" => @panic("TODO"), |
| 801 | |
| 787 | 802 | .c_void, |
| 788 | 803 | .void, |
| 789 | 804 | .type, |
| ... | ... | @@ -908,6 +923,10 @@ pub const Type = extern union { |
| 908 | 923 | @panic("TODO abiAlignment error union"); |
| 909 | 924 | }, |
| 910 | 925 | |
| 926 | .@"enum" => self.cast(Payload.Enum).?.abiAlignment(), |
| 927 | .@"struct" => @panic("TODO"), |
| 928 | .@"union" => @panic("TODO"), |
| 929 | |
| 911 | 930 | .c_void, |
| 912 | 931 | .void, |
| 913 | 932 | .type, |
| ... | ... | @@ -1050,6 +1069,10 @@ pub const Type = extern union { |
| 1050 | 1069 | } |
| 1051 | 1070 | @panic("TODO abiSize error union"); |
| 1052 | 1071 | }, |
| 1072 | |
| 1073 | .@"enum" => @panic("TODO"), |
| 1074 | .@"struct" => @panic("TODO"), |
| 1075 | .@"union" => @panic("TODO"), |
| 1053 | 1076 | }; |
| 1054 | 1077 | } |
| 1055 | 1078 | |
| ... | ... | @@ -1117,6 +1140,9 @@ pub const Type = extern union { |
| 1117 | 1140 | .error_set, |
| 1118 | 1141 | .error_set_single, |
| 1119 | 1142 | .empty_struct, |
| 1143 | .@"enum", |
| 1144 | .@"struct", |
| 1145 | .@"union", |
| 1120 | 1146 | => false, |
| 1121 | 1147 | |
| 1122 | 1148 | .single_const_pointer, |
| ... | ... | @@ -1192,6 +1218,9 @@ pub const Type = extern union { |
| 1192 | 1218 | .error_set, |
| 1193 | 1219 | .error_set_single, |
| 1194 | 1220 | .empty_struct, |
| 1221 | .@"enum", |
| 1222 | .@"struct", |
| 1223 | .@"union", |
| 1195 | 1224 | => false, |
| 1196 | 1225 | |
| 1197 | 1226 | .const_slice, |
| ... | ... | @@ -1264,6 +1293,9 @@ pub const Type = extern union { |
| 1264 | 1293 | .error_set, |
| 1265 | 1294 | .error_set_single, |
| 1266 | 1295 | .empty_struct, |
| 1296 | .@"enum", |
| 1297 | .@"struct", |
| 1298 | .@"union", |
| 1267 | 1299 | => false, |
| 1268 | 1300 | |
| 1269 | 1301 | .single_const_pointer, |
| ... | ... | @@ -1345,6 +1377,9 @@ pub const Type = extern union { |
| 1345 | 1377 | .error_set, |
| 1346 | 1378 | .error_set_single, |
| 1347 | 1379 | .empty_struct, |
| 1380 | .@"enum", |
| 1381 | .@"struct", |
| 1382 | .@"union", |
| 1348 | 1383 | => false, |
| 1349 | 1384 | |
| 1350 | 1385 | .pointer => { |
| ... | ... | @@ -1421,6 +1456,9 @@ pub const Type = extern union { |
| 1421 | 1456 | .error_set, |
| 1422 | 1457 | .error_set_single, |
| 1423 | 1458 | .empty_struct, |
| 1459 | .@"enum", |
| 1460 | .@"struct", |
| 1461 | .@"union", |
| 1424 | 1462 | => false, |
| 1425 | 1463 | |
| 1426 | 1464 | .pointer => { |
| ... | ... | @@ -1539,6 +1577,9 @@ pub const Type = extern union { |
| 1539 | 1577 | .error_set, |
| 1540 | 1578 | .error_set_single, |
| 1541 | 1579 | .empty_struct, |
| 1580 | .@"enum", |
| 1581 | .@"struct", |
| 1582 | .@"union", |
| 1542 | 1583 | => unreachable, |
| 1543 | 1584 | |
| 1544 | 1585 | .array => self.cast(Payload.Array).?.elem_type, |
| ... | ... | @@ -1667,6 +1708,9 @@ pub const Type = extern union { |
| 1667 | 1708 | .error_set, |
| 1668 | 1709 | .error_set_single, |
| 1669 | 1710 | .empty_struct, |
| 1711 | .@"enum", |
| 1712 | .@"struct", |
| 1713 | .@"union", |
| 1670 | 1714 | => unreachable, |
| 1671 | 1715 | |
| 1672 | 1716 | .array => self.cast(Payload.Array).?.len, |
| ... | ... | @@ -1733,6 +1777,9 @@ pub const Type = extern union { |
| 1733 | 1777 | .error_set, |
| 1734 | 1778 | .error_set_single, |
| 1735 | 1779 | .empty_struct, |
| 1780 | .@"enum", |
| 1781 | .@"struct", |
| 1782 | .@"union", |
| 1736 | 1783 | => unreachable, |
| 1737 | 1784 | |
| 1738 | 1785 | .single_const_pointer, |
| ... | ... | @@ -1816,6 +1863,9 @@ pub const Type = extern union { |
| 1816 | 1863 | .error_set, |
| 1817 | 1864 | .error_set_single, |
| 1818 | 1865 | .empty_struct, |
| 1866 | .@"enum", |
| 1867 | .@"struct", |
| 1868 | .@"union", |
| 1819 | 1869 | => false, |
| 1820 | 1870 | |
| 1821 | 1871 | .int_signed, |
| ... | ... | @@ -1891,6 +1941,9 @@ pub const Type = extern union { |
| 1891 | 1941 | .error_set, |
| 1892 | 1942 | .error_set_single, |
| 1893 | 1943 | .empty_struct, |
| 1944 | .@"enum", |
| 1945 | .@"struct", |
| 1946 | .@"union", |
| 1894 | 1947 | => false, |
| 1895 | 1948 | |
| 1896 | 1949 | .int_unsigned, |
| ... | ... | @@ -1956,6 +2009,9 @@ pub const Type = extern union { |
| 1956 | 2009 | .error_set, |
| 1957 | 2010 | .error_set_single, |
| 1958 | 2011 | .empty_struct, |
| 2012 | .@"enum", |
| 2013 | .@"struct", |
| 2014 | .@"union", |
| 1959 | 2015 | => unreachable, |
| 1960 | 2016 | |
| 1961 | 2017 | .int_unsigned => .{ .signed = false, .bits = self.cast(Payload.IntUnsigned).?.bits }, |
| ... | ... | @@ -2039,6 +2095,9 @@ pub const Type = extern union { |
| 2039 | 2095 | .error_set, |
| 2040 | 2096 | .error_set_single, |
| 2041 | 2097 | .empty_struct, |
| 2098 | .@"enum", |
| 2099 | .@"struct", |
| 2100 | .@"union", |
| 2042 | 2101 | => false, |
| 2043 | 2102 | |
| 2044 | 2103 | .usize, |
| ... | ... | @@ -2151,6 +2210,9 @@ pub const Type = extern union { |
| 2151 | 2210 | .error_set, |
| 2152 | 2211 | .error_set_single, |
| 2153 | 2212 | .empty_struct, |
| 2213 | .@"enum", |
| 2214 | .@"struct", |
| 2215 | .@"union", |
| 2154 | 2216 | => unreachable, |
| 2155 | 2217 | }; |
| 2156 | 2218 | } |
| ... | ... | @@ -2229,6 +2291,9 @@ pub const Type = extern union { |
| 2229 | 2291 | .error_set, |
| 2230 | 2292 | .error_set_single, |
| 2231 | 2293 | .empty_struct, |
| 2294 | .@"enum", |
| 2295 | .@"struct", |
| 2296 | .@"union", |
| 2232 | 2297 | => unreachable, |
| 2233 | 2298 | } |
| 2234 | 2299 | } |
| ... | ... | @@ -2306,6 +2371,9 @@ pub const Type = extern union { |
| 2306 | 2371 | .error_set, |
| 2307 | 2372 | .error_set_single, |
| 2308 | 2373 | .empty_struct, |
| 2374 | .@"enum", |
| 2375 | .@"struct", |
| 2376 | .@"union", |
| 2309 | 2377 | => unreachable, |
| 2310 | 2378 | } |
| 2311 | 2379 | } |
| ... | ... | @@ -2383,6 +2451,9 @@ pub const Type = extern union { |
| 2383 | 2451 | .error_set, |
| 2384 | 2452 | .error_set_single, |
| 2385 | 2453 | .empty_struct, |
| 2454 | .@"enum", |
| 2455 | .@"struct", |
| 2456 | .@"union", |
| 2386 | 2457 | => unreachable, |
| 2387 | 2458 | }; |
| 2388 | 2459 | } |
| ... | ... | @@ -2457,6 +2528,9 @@ pub const Type = extern union { |
| 2457 | 2528 | .error_set, |
| 2458 | 2529 | .error_set_single, |
| 2459 | 2530 | .empty_struct, |
| 2531 | .@"enum", |
| 2532 | .@"struct", |
| 2533 | .@"union", |
| 2460 | 2534 | => unreachable, |
| 2461 | 2535 | }; |
| 2462 | 2536 | } |
| ... | ... | @@ -2531,6 +2605,9 @@ pub const Type = extern union { |
| 2531 | 2605 | .error_set, |
| 2532 | 2606 | .error_set_single, |
| 2533 | 2607 | .empty_struct, |
| 2608 | .@"enum", |
| 2609 | .@"struct", |
| 2610 | .@"union", |
| 2534 | 2611 | => unreachable, |
| 2535 | 2612 | }; |
| 2536 | 2613 | } |
| ... | ... | @@ -2605,6 +2682,9 @@ pub const Type = extern union { |
| 2605 | 2682 | .error_set, |
| 2606 | 2683 | .error_set_single, |
| 2607 | 2684 | .empty_struct, |
| 2685 | .@"enum", |
| 2686 | .@"struct", |
| 2687 | .@"union", |
| 2608 | 2688 | => false, |
| 2609 | 2689 | }; |
| 2610 | 2690 | } |
| ... | ... | @@ -2664,6 +2744,10 @@ pub const Type = extern union { |
| 2664 | 2744 | .error_set_single, |
| 2665 | 2745 | => return null, |
| 2666 | 2746 | |
| 2747 | .@"enum" => @panic("TODO onePossibleValue enum"), |
| 2748 | .@"struct" => @panic("TODO onePossibleValue struct"), |
| 2749 | .@"union" => @panic("TODO onePossibleValue union"), |
| 2750 | |
| 2667 | 2751 | .empty_struct => return Value.initTag(.empty_struct_value), |
| 2668 | 2752 | .void => return Value.initTag(.void_value), |
| 2669 | 2753 | .noreturn => return Value.initTag(.unreachable_value), |
| ... | ... | @@ -2773,6 +2857,9 @@ pub const Type = extern union { |
| 2773 | 2857 | .error_set, |
| 2774 | 2858 | .error_set_single, |
| 2775 | 2859 | .empty_struct, |
| 2860 | .@"enum", |
| 2861 | .@"struct", |
| 2862 | .@"union", |
| 2776 | 2863 | => return false, |
| 2777 | 2864 | |
| 2778 | 2865 | .c_const_pointer, |
| ... | ... | @@ -2861,6 +2948,9 @@ pub const Type = extern union { |
| 2861 | 2948 | => unreachable, |
| 2862 | 2949 | |
| 2863 | 2950 | .empty_struct => self.cast(Type.Payload.EmptyStruct).?.scope, |
| 2951 | .@"enum" => &self.cast(Type.Payload.Enum).?.scope, |
| 2952 | .@"struct" => &self.cast(Type.Payload.Struct).?.scope, |
| 2953 | .@"union" => &self.cast(Type.Payload.Union).?.scope, |
| 2864 | 2954 | }; |
| 2865 | 2955 | } |
| 2866 | 2956 | |
| ... | ... | @@ -3012,6 +3102,9 @@ pub const Type = extern union { |
| 3012 | 3102 | error_set, |
| 3013 | 3103 | error_set_single, |
| 3014 | 3104 | empty_struct, |
| 3105 | @"enum", |
| 3106 | @"struct", |
| 3107 | @"union", |
| 3015 | 3108 | |
| 3016 | 3109 | pub const last_no_payload_tag = Tag.const_slice_u8; |
| 3017 | 3110 | pub const no_payload_count = @enumToInt(last_no_payload_tag) + 1; |
| ... | ... | @@ -3127,6 +3220,10 @@ pub const Type = extern union { |
| 3127 | 3220 | |
| 3128 | 3221 | scope: *Module.Scope.Container, |
| 3129 | 3222 | }; |
| 3223 | |
| 3224 | pub const Enum = @import("value/Enum.zig"); |
| 3225 | pub const Struct = @import("value/Struct.zig"); |
| 3226 | pub const Union = @import("value/Union.zig"); |
| 3130 | 3227 | }; |
| 3131 | 3228 | }; |
| 3132 | 3229 | |