diff options
| author | Luuk de Gram <luuk@degram.dev> | 2022-10-12 10:38:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-12 04:38:07 -0400 |
| commit | 1f196b9e2f9213fa395427bd5a8282ab154b1fe6 (patch) | |
| tree | 32d35ba10b5cb2aeb5efc99d14eded8b8942ab34 /test/behavior/export.zig | |
| parent | 62258555b6b69538086cfd3d16b748ffdb5c5dca (diff) | |
| download | zig-1f196b9e2f9213fa395427bd5a8282ab154b1fe6.tar.gz zig-1f196b9e2f9213fa395427bd5a8282ab154b1fe6.zip | |
stage2: implement exporting using field access (#13136)
This implements `@export(a.b, .{..});` in semantic analysis,
allowing users to directly export a variable from a namespace.
* add test case for exporting using field access
Diffstat (limited to 'test/behavior/export.zig')
| -rw-r--r-- | test/behavior/export.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/export.zig b/test/behavior/export.zig index 3943fd2834..02d455236f 100644 --- a/test/behavior/export.zig +++ b/test/behavior/export.zig @@ -55,3 +55,16 @@ test "exporting with internal linkage" { }; S.foo(); } + +test "exporting using field access" { + const S = struct { + const Inner = struct { + const x: u32 = 5; + }; + comptime { + @export(Inner.x, .{ .name = "foo", .linkage = .Internal }); + } + }; + + _ = S.Inner.x; +} |
