aboutsummaryrefslogtreecommitdiff
path: root/src/InternPool.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-12-18 16:43:14 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-01-15 15:11:35 -0800
commit91efc5c98bb32f3b1d42895362d5ae5a175a1345 (patch)
tree43b1ce691421c7be95044e93f66ef9ef04958729 /src/InternPool.zig
parent1a58ae2ed6d38a2a73cacb8b97f2885685505838 (diff)
downloadzig-91efc5c98bb32f3b1d42895362d5ae5a175a1345.tar.gz
zig-91efc5c98bb32f3b1d42895362d5ae5a175a1345.zip
wasm linker: fix calling imported functions
and more disciplined type safety for output function indexes
Diffstat (limited to 'src/InternPool.zig')
-rw-r--r--src/InternPool.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig
index 2a21be9bbe..a43c5a7d3a 100644
--- a/src/InternPool.zig
+++ b/src/InternPool.zig
@@ -621,6 +621,14 @@ pub const Nav = struct {
}
/// Asserts that `status == .resolved`.
+ pub fn toExtern(nav: *const Nav, ip: *const InternPool) ?Key.Extern {
+ return switch (ip.indexToKey(nav.status.resolved.val)) {
+ .@"extern" => |ext| ext,
+ else => null,
+ };
+ }
+
+ /// Asserts that `status == .resolved`.
pub fn isThreadLocal(nav: Nav, ip: *const InternPool) bool {
const val = nav.status.resolved.val;
if (!isVariable(ip, val)) return false;