From 76fcb95bdf5509f6b02ca8c68af2b8f630a6cfe0 Mon Sep 17 00:00:00 2001 From: Krzysztof Wolicki Der Teufel Date: Sun, 29 Jan 2023 14:42:18 +0100 Subject: [PATCH] autodoc: Implemented struct_init_empty for walkInstruction, fixed variable type with has_init but no type before = --- src/Autodoc.zig | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/Autodoc.zig b/src/Autodoc.zig index 8afc9c859b..e51d4a3ca9 100644 --- a/src/Autodoc.zig +++ b/src/Autodoc.zig @@ -2200,17 +2200,10 @@ fn walkInstruction( false, ); - _ = operand; - - // WIP - - printWithContext( - file, - inst_index, - "TODO: implement `{s}` for walkInstruction\n\n", - .{@tagName(tags[inst_index])}, - ); - return self.cteTodo(@tagName(tags[inst_index])); + return DocData.WalkResult{ + .typeRef = operand.expr, + .expr = .{ .@"struct" = &.{} }, + }; }, .struct_init_anon => { const pl_node = data[inst_index].pl_node; @@ -2537,6 +2530,7 @@ fn walkInstruction( const var_init_ref = @intToEnum(Ref, file.zir.extra[extra_index]); const var_init = try self.walkRef(file, parent_scope, parent_src, var_init_ref, need_type); value.expr = var_init.expr; + value.typeRef = var_init.typeRef; } return value;