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(...@@ -1007,22 +1007,16 @@ fn walkInstruction(
1007 // we only ask to figure out type info for the first element1007 // we only ask to figure out type info for the first element
1008 // as it will be used later on to find out the array type!1008 // as it will be used later on to find out the array type!
1009 const wr = try self.walkRef(file, parent_scope, op, idx == 0);1009 const wr = try self.walkRef(file, parent_scope, op, idx == 0);
1010
1011 if (idx == 0) {1010 if (idx == 0) {
1012 array_type = wr.typeRef;1011 array_type = wr.typeRef;
1013 }1012 }
10141013
1015 // create an untion to hold more than one type1014 // array_init_anon doesn't have the elements in @as nodes
1016 switch (@intToEnum(Ref, wr.typeRef.?.type)) {1015 // so it's necessary append them to expr array
1017 .comptime_int_type => {1016 // and remember their positions
1018 array_data[idx] = wr.expr.int.value;1017 const expr_index = self.exprs.items.len;
1019 },1018 try self.exprs.append(self.arena, wr.expr);
1020 .comptime_float_type => {1019 array_data[idx] = expr_index;
1021 unreachable;
1022 // array_data[idx] = wr.expr.float;
1023 },
1024 else => continue,
1025 }
1026 }1020 }
10271021
1028 const type_slot_index = self.types.items.len;1022 const type_slot_index = self.types.items.len;