From 6f6b14621d5a0935d39295d21b5ffad2197f0e2f Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Fri, 9 Sep 2022 15:34:43 +0300 Subject: value: hash extern functions Closes #12766 --- src/value.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/value.zig') diff --git a/src/value.zig b/src/value.zig index 50f86c7e79..0580d7cd3c 100644 --- a/src/value.zig +++ b/src/value.zig @@ -2391,12 +2391,15 @@ pub const Value = extern union { union_obj.val.hash(active_field_ty, hasher, mod); }, .Fn => { - const func: *Module.Fn = val.castTag(.function).?.data; - // Note that his hashes the *Fn rather than the *Decl. This is + // Note that his hashes the *Fn/*ExternFn rather than the *Decl. This is // to differentiate function bodies from function pointers. // This is currently redundant since we already hash the zig type tag // at the top of this function. - std.hash.autoHash(hasher, func); + if (val.castTag(.function)) |func| { + std.hash.autoHash(hasher, func.data); + } else if (val.castTag(.extern_fn)) |func| { + std.hash.autoHash(hasher, func.data); + } else unreachable; }, .Frame => { @panic("TODO implement hashing frame values"); -- cgit v1.2.3