aboutsummaryrefslogtreecommitdiff
path: root/src/link/Plan9.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-10-26 20:32:16 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-10-26 20:32:16 -0700
commit4bc88dd11641a664d80b00ad784bafc6da776697 (patch)
tree0dfff49ae93d5826a0c10e3819a1225e4f992693 /src/link/Plan9.zig
parentba9e38847a097777370b4721780d5dbefda1b12f (diff)
downloadzig-4bc88dd11641a664d80b00ad784bafc6da776697.tar.gz
zig-4bc88dd11641a664d80b00ad784bafc6da776697.zip
link: support exporting constant values without a Decl
The main motivating change here is to prevent the creation of a fake Decl object by the frontend in order to `@export()` a value. Instead, `link.updateDeclExports` is renamed to `link.updateExports` and accepts a tagged union which can be either a Decl.Index or a InternPool.Index.
Diffstat (limited to 'src/link/Plan9.zig')
-rw-r--r--src/link/Plan9.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig
index 3dcef859ae..96d2bdf7b4 100644
--- a/src/link/Plan9.zig
+++ b/src/link/Plan9.zig
@@ -1116,13 +1116,16 @@ pub fn seeDecl(self: *Plan9, decl_index: Module.Decl.Index) !Atom.Index {
return atom_idx;
}
-pub fn updateDeclExports(
+pub fn updateExports(
self: *Plan9,
module: *Module,
- decl_index: Module.Decl.Index,
+ exported: Module.Exported,
exports: []const *Module.Export,
) !void {
- _ = try self.seeDecl(decl_index);
+ switch (exported) {
+ .value => @panic("TODO: plan9 updateExports handling values"),
+ .decl_index => |decl_index| _ = try self.seeDecl(decl_index),
+ }
// we do all the things in flush
_ = module;
_ = exports;