| ... | ... | @@ -655,6 +655,7 @@ const DocData = struct { |
| 655 | 655 | errorUnion: usize, // index in `exprs` |
| 656 | 656 | as: As, |
| 657 | 657 | sizeOf: usize, // index in `exprs` |
| 658 | bitSizeOf: usize, // index in `exprs` |
| 658 | 659 | compileError: []const u8, |
| 659 | 660 | string: []const u8, // direct value |
| 660 | 661 | // Index a `type` like struct with expressions |
| ... | ... | @@ -730,6 +731,11 @@ const DocData = struct { |
| 730 | 731 | \\{{ "sizeOf":{} }} |
| 731 | 732 | , .{v}); |
| 732 | 733 | }, |
| 734 | .bitSizeOf => |v| { |
| 735 | try w.print( |
| 736 | \\{{ "bitSizeOf":{} }} |
| 737 | , .{v}); |
| 738 | }, |
| 733 | 739 | .fieldRef => |v| try std.json.stringify( |
| 734 | 740 | struct { fieldRef: FieldRef }{ .fieldRef = v }, |
| 735 | 741 | options, |
| ... | ... | @@ -2151,6 +2157,22 @@ fn walkInstruction( |
| 2151 | 2157 | .expr = .{ .sizeOf = operand_index }, |
| 2152 | 2158 | }; |
| 2153 | 2159 | }, |
| 2160 | .bit_size_of => { |
| 2161 | // not working correctly with `align()` |
| 2162 | const un_node = data[inst_index].un_node; |
| 2163 | const operand = try self.walkRef( |
| 2164 | file, |
| 2165 | parent_scope, |
| 2166 | un_node.operand, |
| 2167 | false, |
| 2168 | ); |
| 2169 | const operand_index = self.exprs.items.len; |
| 2170 | try self.exprs.append(self.arena, operand.expr); |
| 2171 | return DocData.WalkResult{ |
| 2172 | .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, |
| 2173 | .expr = .{ .bitSizeOf = operand_index }, |
| 2174 | }; |
| 2175 | }, |
| 2154 | 2176 | |
| 2155 | 2177 | .typeof => { |
| 2156 | 2178 | const un_node = data[inst_index].un_node; |