| ... | @@ -57,16 +57,19 @@ pub const Context = struct { | ... | @@ -57,16 +57,19 @@ pub const Context = struct { |
| 57 | /// will have the index that comes after the last argument's index | 57 | /// will have the index that comes after the last argument's index |
| 58 | local_index: u32 = 0, | 58 | local_index: u32 = 0, |
| 59 | /// If codegen fails, an error messages will be allocated and saved in `err_msg` | 59 | /// If codegen fails, an error messages will be allocated and saved in `err_msg` |
| 60 | err_msg: *Compilation.ErrorMsg, | 60 | err_msg: *Module.ErrorMsg, |
| 61 | | 61 | |
| 62 | const InnerError = error{ | 62 | const InnerError = error{ |
| 63 | OutOfMemory, | 63 | OutOfMemory, |
| 64 | CodegenFail, | 64 | CodegenFail, |
| 65 | }; | 65 | }; |
| 66 | | 66 | |
| 67 | /// Sets `err_msg` on `Context` and returns `error.CodegemFail` which is caught in link/Wasm.zig | 67 | /// Sets `err_msg` on `Context` and returns `error.CodegenFail` which is caught in link/Wasm.zig |
| 68 | fn fail(self: *Context, src: usize, comptime fmt: []const u8, args: anytype) InnerError { | 68 | fn fail(self: *Context, src: usize, comptime fmt: []const u8, args: anytype) InnerError { |
| 69 | self.err_msg = try Compilation.ErrorMsg.create(self.gpa, src, fmt, args); | 69 | self.err_msg = try Module.ErrorMsg.create(self.gpa, .{ |
| | 70 | .file_scope = self.decl.getFileScope(), |
| | 71 | .byte_offset = src, |
| | 72 | }, fmt, args); |
| 70 | return error.CodegenFail; | 73 | return error.CodegenFail; |
| 71 | } | 74 | } |
| 72 | | 75 | |