authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-16 23:24:00-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-16 23:24:00-07:00
log629d3bea1b6aa7660364448cf4e0c045d931be52
tree82e1d68b74a947f390e65e4548874ee47f93deee
parent8c9ac4db978c80246b4872c899b1618b1b195ec2

stage2: slight cleanup of Module by calling astgen functions


1 files changed, 2 insertions(+), 8 deletions(-)

src/Module.zig+2-8
...@@ -1342,8 +1342,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool {...@@ -1342,8 +1342,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool {
1342 break :rl .{ .ty = var_type };1342 break :rl .{ .ty = var_type };
1343 } else .none;1343 } else .none;
13441344
1345 const src = tree.token_locs[init_node.firstToken()].start;1345 const init_inst = try astgen.comptimeExpr(self, &gen_scope.base, init_result_loc, init_node);
1346 const init_inst = try astgen.expr(self, &gen_scope.base, init_result_loc, init_node);
1347 if (std.builtin.mode == .Debug and self.comp.verbose_ir) {1346 if (std.builtin.mode == .Debug and self.comp.verbose_ir) {
1348 zir.dumpZir(self.gpa, "var_init", decl.name, gen_scope.instructions.items) catch {};1347 zir.dumpZir(self.gpa, "var_init", decl.name, gen_scope.instructions.items) catch {};
1349 }1348 }
...@@ -1392,12 +1391,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool {...@@ -1392,12 +1391,7 @@ fn astGenAndAnalyzeDecl(self: *Module, decl: *Decl) !bool {
1392 };1391 };
1393 defer type_scope.instructions.deinit(self.gpa);1392 defer type_scope.instructions.deinit(self.gpa);
13941393
1395 const src = tree.token_locs[type_node.firstToken()].start;1394 const var_type = try astgen.typeExpr(self, &type_scope.base, type_node);
1396 const type_type = try astgen.addZIRInstConst(self, &type_scope.base, src, .{
1397 .ty = Type.initTag(.type),
1398 .val = Value.initTag(.type_type),
1399 });
1400 const var_type = try astgen.expr(self, &type_scope.base, .{ .ty = type_type }, type_node);
1401 if (std.builtin.mode == .Debug and self.comp.verbose_ir) {1395 if (std.builtin.mode == .Debug and self.comp.verbose_ir) {
1402 zir.dumpZir(self.gpa, "var_type", decl.name, type_scope.instructions.items) catch {};1396 zir.dumpZir(self.gpa, "var_type", decl.name, type_scope.instructions.items) catch {};
1403 }1397 }