Commit 76fcb95bdf

Krzysztof Wolicki Der Teufel <der.teufel.mail@gmail.com>
2023-01-29 14:42:18
autodoc: Implemented struct_init_empty for walkInstruction, fixed variable type with has_init but no type before =
1 parent f68d3c6
Changed files (1)
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;