Skip to content

Commit

Permalink
update diagnostic usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoff-it committed Feb 20, 2024
1 parent 639f558 commit 39f05ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/cli/fmt.zig
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pub fn run(gpa: std.mem.Allocator, args: []const []const u8) !void {

const code = try buf.toOwnedSliceSentinel(0);

var diag: Diagnostic = .{};
const ast = Ast.init(gpa, code, null, true, &diag) catch {
var diag: Diagnostic = .{ .path = null };
const ast = Ast.init(gpa, code, true, &diag) catch {
std.debug.print("{}", .{diag});
std.process.exit(1);
};
Expand Down
4 changes: 2 additions & 2 deletions src/cli/lsp.zig
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ const Handler = struct {
var buf = std.ArrayList(u8).init(self.gpa);
defer buf.deinit();

var diag: ziggy.Diagnostic = .{};
var diag: ziggy.Diagnostic = .{ .path = null };

const ast = ziggy.Ast.init(self.gpa, new_text, null, true, &diag) catch undefined;
const ast = ziggy.Ast.init(self.gpa, new_text, true, &diag) catch undefined;
defer if (std.meta.activeTag(diag.err) == .none) ast.deinit();

if (std.meta.activeTag(diag.err) != .none) {
Expand Down

0 comments on commit 39f05ae

Please sign in to comment.