diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-10-17 14:50:47 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-10-17 14:55:32 -0700 |
| commit | 6534f2ef4f8161f4121326f19bc3cf89324f62c5 (patch) | |
| tree | 87fb9d6f2b082a534402080f53febf483d81e7fc /src/Module.zig | |
| parent | 53b87fa78a3ee2c261f3bdd6a71d5733fe17ffd5 (diff) | |
| download | zig-6534f2ef4f8161f4121326f19bc3cf89324f62c5.tar.gz zig-6534f2ef4f8161f4121326f19bc3cf89324f62c5.zip | |
stage2: implement error wrapping
* Sema: fix returned operands not coercing to the function return type
in some cases.
- When returning an error or an error union from a function with an
inferred error set, it will now populate the inferred error set.
- Implement error set coercion for the common case of inferred error
set to inferred error set, without forcing a full resolution.
* LLVM backend: update instruction lowering that handles error unions
to respect `isByRef`.
- Also implement `wrap_err_union_err`.
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig index a42ec3c2e1..f52e1c8ef7 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -782,6 +782,10 @@ pub const ErrorSet = struct { /// The length is given by `names_len`. names_ptr: [*]const []const u8, + pub fn names(self: ErrorSet) []const []const u8 { + return self.names_ptr[0..self.names_len]; + } + pub fn srcLoc(self: ErrorSet) SrcLoc { return .{ .file_scope = self.owner_decl.getFileScope(), |
