authorgravatar for vallahor91@gmail.comVallahor <vallahor91@gmail.com> 2022-05-29 05:56:26-03:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-19 19:10:12-07:00
log1213123ad04e90d67b5c004ddc8744fe409cd839
tree83a37ab79dde69f14e2879945481baa49dd373e0
parentd23ccdb8d9e4d3510667164545f9c3be3374d529

fix: *.{} array are now printed as type *[]comptime


2 files changed, 12 insertions(+), 12 deletions(-)

lib/docs/main.js+3
...@@ -1329,6 +1329,9 @@ var zigAnalysis;...@@ -1329,6 +1329,9 @@ var zigAnalysis;
1329 name += is_mutable;1329 name += is_mutable;
1330 break;1330 break;
1331 case pointerSizeEnum.Slice:1331 case pointerSizeEnum.Slice:
1332 if (ptrObj.is_ref) {
1333 name += "*";
1334 }
1332 name += "[";1335 name += "[";
1333 name += sentinel;1336 name += sentinel;
1334 name += "]";1337 name += "]";
src/Autodoc.zig+9-12
...@@ -416,6 +416,7 @@ const DocData = struct {...@@ -416,6 +416,7 @@ const DocData = struct {
416 address_space: ?Expr = null,416 address_space: ?Expr = null,
417 bit_start: ?Expr = null,417 bit_start: ?Expr = null,
418 host_size: ?Expr = null,418 host_size: ?Expr = null,
419 is_ref: bool = false,
419 is_allowzero: bool = false,420 is_allowzero: bool = false,
420 is_mutable: bool = false,421 is_mutable: bool = false,
421 is_volatile: bool = false,422 is_volatile: bool = false,
...@@ -582,8 +583,9 @@ const DocData = struct {...@@ -582,8 +583,9 @@ const DocData = struct {
582 \\"has_align": {},583 \\"has_align": {},
583 \\"has_addrspace": {},584 \\"has_addrspace": {},
584 \\"has_bit_range": {},585 \\"has_bit_range": {},
586 \\"is_ref": {},
585 \\587 \\
586 , .{ v.is_allowzero, v.is_mutable, v.is_volatile, v.has_sentinel, v.has_align, v.has_addrspace, v.has_bit_range });588 , .{ v.is_allowzero, v.is_mutable, v.is_volatile, v.has_sentinel, v.has_align, v.has_addrspace, v.has_bit_range, v.is_ref });
587 if (options.whitespace) |ws| try ws.outputIndent(w);589 if (options.whitespace) |ws| try ws.outputIndent(w);
588 try w.print(590 try w.print(
589 \\"child":591 \\"child":
...@@ -1962,17 +1964,12 @@ fn walkInstruction(...@@ -1962,17 +1964,12 @@ fn walkInstruction(
1962 }1964 }
19631965
1964 const type_slot_index = self.types.items.len;1966 const type_slot_index = self.types.items.len;
1965 try self.types.append(self.arena, .{1967 try self.types.append(self.arena, .{ .Pointer = .{
1966 .Array = .{1968 .size = .Slice,
1967 .len = .{1969 .child = array_type.?,
1968 .int = .{1970 .is_mutable = true,
1969 .value = operands.len - 1,1971 .is_ref = true,
1970 .negated = false,1972 } });
1971 },
1972 },
1973 .child = array_type.?,
1974 },
1975 });
19761973
1977 return DocData.WalkResult{1974 return DocData.WalkResult{
1978 .typeRef = .{ .type = type_slot_index },1975 .typeRef = .{ .type = type_slot_index },