diff options
| author | Veikka Tuominen <git@vexu.eu> | 2023-11-17 20:33:49 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-01-22 18:08:56 -0800 |
| commit | eeec34ccb6189a588b1227a57e7c7b98af849b8d (patch) | |
| tree | 4e4d33e31b8cd5f89a605dc6171c73869783237b /src/Module.zig | |
| parent | 9e684e8d1af39904055abe64a9afda69a3d44a59 (diff) | |
| download | zig-eeec34ccb6189a588b1227a57e7c7b98af849b8d.tar.gz zig-eeec34ccb6189a588b1227a57e7c7b98af849b8d.zip | |
Sema: implement comptime error return traces
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig index 8f6f0e34d1..7637e40798 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -3479,6 +3479,9 @@ pub fn semaFile(mod: *Module, file: *File) SemaError!void { var comptime_mutable_decls = std.ArrayList(Decl.Index).init(gpa); defer comptime_mutable_decls.deinit(); + var comptime_err_ret_trace = std.ArrayList(SrcLoc).init(gpa); + defer comptime_err_ret_trace.deinit(); + var sema: Sema = .{ .mod = mod, .gpa = gpa, @@ -3492,6 +3495,7 @@ pub fn semaFile(mod: *Module, file: *File) SemaError!void { .fn_ret_ty_ies = null, .owner_func_index = .none, .comptime_mutable_decls = &comptime_mutable_decls, + .comptime_err_ret_trace = &comptime_err_ret_trace, }; defer sema.deinit(); @@ -3600,6 +3604,9 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { var comptime_mutable_decls = std.ArrayList(Decl.Index).init(gpa); defer comptime_mutable_decls.deinit(); + var comptime_err_ret_trace = std.ArrayList(SrcLoc).init(gpa); + defer comptime_err_ret_trace.deinit(); + var sema: Sema = .{ .mod = mod, .gpa = gpa, @@ -3613,6 +3620,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { .fn_ret_ty_ies = null, .owner_func_index = .none, .comptime_mutable_decls = &comptime_mutable_decls, + .comptime_err_ret_trace = &comptime_err_ret_trace, .builtin_type_target_index = builtin_type_target_index, }; defer sema.deinit(); @@ -4451,6 +4459,9 @@ pub fn analyzeFnBody(mod: *Module, func_index: InternPool.Index, arena: Allocato var comptime_mutable_decls = std.ArrayList(Decl.Index).init(gpa); defer comptime_mutable_decls.deinit(); + var comptime_err_ret_trace = std.ArrayList(SrcLoc).init(gpa); + defer comptime_err_ret_trace.deinit(); + // In the case of a generic function instance, this is the type of the // instance, which has comptime parameters elided. In other words, it is // the runtime-known parameters only, not to be confused with the @@ -4473,6 +4484,7 @@ pub fn analyzeFnBody(mod: *Module, func_index: InternPool.Index, arena: Allocato .owner_func_index = func_index, .branch_quota = @max(func.branchQuota(ip).*, Sema.default_branch_quota), .comptime_mutable_decls = &comptime_mutable_decls, + .comptime_err_ret_trace = &comptime_err_ret_trace, }; defer sema.deinit(); |
