@@ -37,22 +37,22 @@ const DiagnosticList = std.ArrayList(Diagnostic);
3737pub fn init (allocator : Allocator ) ! Diagnostics {
3838 return Diagnostics {
3939 .allocator = allocator ,
40- .diagnostics = DiagnosticList . init ( allocator ) ,
40+ .diagnostics = .empty ,
4141 };
4242}
4343
4444pub fn deinit (self : * Diagnostics ) void {
4545 for (self .diagnostics .items ) | * diagnostic | {
4646 diagnostic .deinit (self .allocator );
4747 }
48- self .diagnostics .deinit ();
48+ self .diagnostics .deinit (self . allocator );
4949}
5050
5151pub fn reportDiagnostic (self : * Diagnostics , comptime level : DiagnosticLevel , location : Location , comptime message : []const u8 ) ! void {
52- try self .diagnostics .append (Diagnostic { .level = level , .location = location , .message = message , .message_is_allocated = false });
52+ try self .diagnostics .append (self . allocator , . { .level = level , .location = location , .message = message , .message_is_allocated = false });
5353}
5454
5555pub fn reportDiagnosticFormatted (self : * Diagnostics , comptime level : DiagnosticLevel , location : Location , comptime message : []const u8 , args : anytype ) ! void {
5656 const formatted_message = try std .fmt .allocPrint (self .allocator , message , args );
57- try self .diagnostics .append (Diagnostic { .level = level , .location = location , .message = formatted_message , .message_is_allocated = true });
57+ try self .diagnostics .append (self . allocator , . { .level = level , .location = location , .message = formatted_message , .message_is_allocated = true });
5858}
0 commit comments