| ... | @@ -113,6 +113,7 @@ const target_util = @import("target.zig"); | ... | @@ -113,6 +113,7 @@ const target_util = @import("target.zig"); |
| 113 | const Package = @import("Package.zig"); | 113 | const Package = @import("Package.zig"); |
| 114 | const crash_report = @import("crash_report.zig"); | 114 | const crash_report = @import("crash_report.zig"); |
| 115 | const build_options = @import("build_options"); | 115 | const build_options = @import("build_options"); |
| | 116 | const Compilation = @import("Compilation.zig"); |
| 116 | | 117 | |
| 117 | pub const default_branch_quota = 1000; | 118 | pub const default_branch_quota = 1000; |
| 118 | pub const default_reference_trace_len = 2; | 119 | pub const default_reference_trace_len = 2; |
| ... | @@ -2191,18 +2192,16 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { | ... | @@ -2191,18 +2192,16 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { |
| 2191 | @setCold(true); | 2192 | @setCold(true); |
| 2192 | | 2193 | |
| 2193 | if (crash_report.is_enabled and sema.mod.comp.debug_compile_errors) { | 2194 | if (crash_report.is_enabled and sema.mod.comp.debug_compile_errors) { |
| 2194 | const err_path = err_msg.src_loc.file_scope.fullPath(sema.mod.gpa) catch unreachable; | | |
| 2195 | const err_source = err_msg.src_loc.file_scope.getSource(sema.mod.gpa) catch unreachable; | | |
| 2196 | if (err_msg.src_loc.lazy == .unneeded) return error.NeededSourceLocation; | 2195 | if (err_msg.src_loc.lazy == .unneeded) return error.NeededSourceLocation; |
| 2197 | const err_span = err_msg.src_loc.span(sema.mod.gpa) catch unreachable; | 2196 | var arena = std.heap.ArenaAllocator.init(sema.gpa); |
| 2198 | const err_loc = std.zig.findLineColumn(err_source.bytes, err_span.main); | 2197 | errdefer arena.deinit(); |
| 2199 | std.debug.print("compile error during Sema:\n{s}:{d}:{d}: error: {s}\n{s}\n\n", .{ | 2198 | var errors = std.ArrayList(Compilation.AllErrors.Message).init(sema.gpa); |
| 2200 | err_path, | 2199 | defer errors.deinit(); |
| 2201 | err_loc.line + 1, | 2200 | |
| 2202 | err_loc.column + 1, | 2201 | Compilation.AllErrors.add(sema.mod, &arena, &errors, err_msg.*) catch unreachable; |
| 2203 | err_msg.msg, | 2202 | |
| 2204 | err_loc.source_line, | 2203 | std.debug.print("compile error during Sema:\n", .{}); |
| 2205 | }); | 2204 | Compilation.AllErrors.Message.renderToStdErr(errors.items[0], .no_color); |
| 2206 | crash_report.compilerPanic("unexpected compile error occurred", null, null); | 2205 | crash_report.compilerPanic("unexpected compile error occurred", null, null); |
| 2207 | } | 2206 | } |
| 2208 | | 2207 | |