Commit a714f07022
Changed files (1)
src
src/Autodoc.zig
@@ -2594,12 +2594,12 @@ fn walkInstruction(
// We delay analysis because union tags can refer to
// decls defined inside the union itself.
- const tag_type_ref: Ref = if (small.has_tag_type) blk: {
+ const tag_type_ref: ?Ref = if (small.has_tag_type) blk: {
const tag_type = file.zir.extra[extra_index];
extra_index += 1;
const tag_ref = @intToEnum(Ref, tag_type);
break :blk tag_ref;
- } else .none;
+ } else null;
const body_len = if (small.has_body_len) blk: {
const body_len = file.zir.extra[extra_index];
@@ -2626,13 +2626,13 @@ fn walkInstruction(
);
// Analyze the tag once all decls have been analyzed
- const tag_type = try self.walkRef(
+ const tag_type = if (tag_type_ref) |tt_ref| (try self.walkRef(
file,
&scope,
parent_src,
- tag_type_ref,
+ tt_ref,
false,
- );
+ )).expr else null;
// Fields
extra_index += body_len;
@@ -2664,7 +2664,7 @@ fn walkInstruction(
.privDecls = priv_decl_indexes.items,
.pubDecls = decl_indexes.items,
.fields = field_type_refs.items,
- .tag = tag_type.expr,
+ .tag = tag_type,
.auto_enum = small.auto_enum_tag,
.parent_container = parent_scope.enclosing_type,
},
@@ -2855,6 +2855,9 @@ fn walkInstruction(
break :blk fields_len;
} else 0;
+ // We don't care about decls yet
+ if (small.has_decls_len) extra_index += 1;
+
var backing_int: ?DocData.Expr = null;
if (small.has_backing_int) {
const backing_int_body_len = file.zir.extra[extra_index];