aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-01-16 23:24:00 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-01-16 23:24:00 -0700
commit629d3bea1b6aa7660364448cf4e0c045d931be52 (patch)
tree82e1d68b74a947f390e65e4548874ee47f93deee
parent8c9ac4db978c80246b4872c899b1618b1b195ec2 (diff)
downloadzig-629d3bea1b6aa7660364448cf4e0c045d931be52.tar.gz
zig-629d3bea1b6aa7660364448cf4e0c045d931be52.zip
stage2: slight cleanup of Module by calling astgen functions
-rw-r--r--src/Module.zig10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/Module.zig b/src/Module.zig
index e612f8f759..d75c1d2a0d 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 {};
}