blob: 2d4f8bafd9e8bbe3c59491b213bd549e57a9b270 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
const std = @import("std");
fn NamespacedComponents(comptime modules: anytype) type {
return @Type(.{
.Struct = .{
.layout = .Auto,
.is_tuple = false,
.fields = &.{.{
.name = "components",
.type = @TypeOf(modules.components),
.default_value = null,
.is_comptime = false,
.alignment = @alignOf(@TypeOf(modules.components)),
}},
.decls = &[_]std.builtin.Type.Declaration{},
},
});
}
fn namespacedComponents(comptime modules: anytype) NamespacedComponents(modules) {
var x: NamespacedComponents(modules) = undefined;
x.components = modules.components;
return x;
}
pub fn World(comptime modules: anytype) type {
const all_components = namespacedComponents(modules);
_ = all_components;
return struct {};
}
test {
_ = World(.{
.components = .{
.location = struct {},
},
});
}
|