From 629d3bea1b6aa7660364448cf4e0c045d931be52 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 16 Jan 2021 23:24:00 -0700 Subject: [PATCH] stage2: slight cleanup of Module by calling astgen functions --- src/Module.zig | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Module.zig b/src/Module.zig index e612f8f75979..d75c1d2a0de3 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -1342,8 +1342,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool { break :rl .{ .ty = var_type }; } else .none; - const src = tree.token_locs[init_node.firstToken()].start; - const init_inst = try astgen.expr(self, &gen_scope.base, init_result_loc, init_node); + const init_inst = try astgen.comptimeExpr(self, &gen_scope.base, init_result_loc, init_node); if (std.builtin.mode == .Debug and self.comp.verbose_ir) { zir.dumpZir(self.gpa, "var_init", decl.name, gen_scope.instructions.items) catch {}; } @@ -1392,12 +1391,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool { }; defer type_scope.instructions.deinit(self.gpa); - const src = tree.token_locs[type_node.firstToken()].start; - const type_type = try astgen.addZIRInstConst(self, &type_scope.base, src, .{ - .ty = Type.initTag(.type), - .val = Value.initTag(.type_type), - }); - const var_type = try astgen.expr(self, &type_scope.base, .{ .ty = type_type }, type_node); + const var_type = try astgen.typeExpr(self, &type_scope.base, type_node); if (std.builtin.mode == .Debug and self.comp.verbose_ir) { zir.dumpZir(self.gpa, "var_type", decl.name, type_scope.instructions.items) catch {}; }