diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-11 20:44:10 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-11 20:44:10 -0700 |
| commit | 60d6037f236379e521ccb7a8e1b7d24ed469ac3f (patch) | |
| tree | 86db209c223176e6feda699d92612844dc211bc7 /src/Module.zig | |
| parent | 55ba335e0ffc2af76bf0743d98f5a959ccce0409 (diff) | |
| download | zig-60d6037f236379e521ccb7a8e1b7d24ed469ac3f.tar.gz zig-60d6037f236379e521ccb7a8e1b7d24ed469ac3f.zip | |
Sema: fix inline/comptime function calls with inferred errors
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig index b3e0344d77..868ce578eb 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -1542,6 +1542,21 @@ pub const Fn = struct { // const zir = func.owner_decl.getFileScope().zir; return func.param_names[index]; } + + pub fn hasInferredErrorSet(func: Fn) bool { + const zir = func.owner_decl.getFileScope().zir; + const zir_tags = zir.instructions.items(.tag); + switch (zir_tags[func.zir_body_inst]) { + .func => return false, + .func_inferred => return true, + .extended => { + const extended = zir.instructions.items(.data)[func.zir_body_inst].extended; + const small = @bitCast(Zir.Inst.ExtendedFunc.Small, extended.small); + return small.is_inferred_error; + }, + else => unreachable, + } + } }; pub const Var = struct { |
