authorgravatar for vallahor91@gmail.comVallahor <vallahor91@gmail.com> 2022-05-24 00:10:59-03:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-07-19 19:10:11-07:00
logbde1caa4ceecb976e728c04c5aebb34f260d9b70
tree0cf8f0b25dcf7edbc9679c9d334be12ea61199d4
parent21fd4a7a8b100cfb35a67f66bd9887006978ed60

fix: array_init_anon know working


1 files changed, 6 insertions(+), 12 deletions(-)

src/Autodoc.zig+6-12
......@@ -1007,22 +1007,16 @@ fn walkInstruction(
10071007 // we only ask to figure out type info for the first element
10081008 // as it will be used later on to find out the array type!
10091009 const wr = try self.walkRef(file, parent_scope, op, idx == 0);
1010
10111010 if (idx == 0) {
10121011 array_type = wr.typeRef;
10131012 }
10141013
1015 // create an untion to hold more than one type
1016 switch (@intToEnum(Ref, wr.typeRef.?.type)) {
1017 .comptime_int_type => {
1018 array_data[idx] = wr.expr.int.value;
1019 },
1020 .comptime_float_type => {
1021 unreachable;
1022 // array_data[idx] = wr.expr.float;
1023 },
1024 else => continue,
1025 }
1014 // array_init_anon doesn't have the elements in @as nodes
1015 // so it's necessary append them to expr array
1016 // and remember their positions
1017 const expr_index = self.exprs.items.len;
1018 try self.exprs.append(self.arena, wr.expr);
1019 array_data[idx] = expr_index;
10261020 }
10271021
10281022 const type_slot_index = self.types.items.len;