parser: add notes to decl_between_fields error

This commit is contained in:
Veikka Tuominen committed 2022-02-17 22:16:26 +02:00
1 parent 92f2767814
commit 6b65590715
6 files changed
+129 -59

No files matched your search

+11
View File
@@ -3014,6 +3014,17 @@ pub fn astGenFile(mod: *Module, file: *File) !void {
.parent_decl_node = 0,
.lazy = .{ .byte_abs = byte_abs },
}, err_msg, "invalid byte: '{'}'", .{std.zig.fmtEscapes(source[byte_abs..][0..1])});
} else if (parse_err.tag == .decl_between_fields) {
try mod.errNoteNonLazy(.{
.file_scope = file,
.parent_decl_node = 0,
.lazy = .{ .byte_abs = token_starts[file.tree.errors[1].token] },
}, err_msg, "field before declarations here", .{});
try mod.errNoteNonLazy(.{
.file_scope = file,
.parent_decl_node = 0,
.lazy = .{ .byte_abs = token_starts[file.tree.errors[2].token] },
}, err_msg, "field after declarations here", .{});
}
{