aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted/module.zig
diff options
context:
space:
mode:
authorAndrea Orru <andrea@orru.io>2018-04-13 11:11:21 -0700
committerAndrea Orru <andrea@orru.io>2018-04-13 11:11:21 -0700
commit06614b3fa09954464c2e2f32756cacedc178a282 (patch)
tree37cd43b61b1c8be543551ef7e9f6605bce847947 /src-self-hosted/module.zig
parentd2c672ab0cc969f97e30cf6a12e4bffcac7cee18 (diff)
parentfa05cab01a755827209b6ede299402f515681a81 (diff)
downloadzig-06614b3fa09954464c2e2f32756cacedc178a282.tar.gz
zig-06614b3fa09954464c2e2f32756cacedc178a282.zip
Merge branch 'master' into zen_stdlib
Diffstat (limited to 'src-self-hosted/module.zig')
-rw-r--r--src-self-hosted/module.zig23
1 files changed, 23 insertions, 0 deletions
diff --git a/src-self-hosted/module.zig b/src-self-hosted/module.zig
index 464737bbbb..eec30749e2 100644
--- a/src-self-hosted/module.zig
+++ b/src-self-hosted/module.zig
@@ -109,6 +109,29 @@ pub const Module = struct {
LlvmIr,
};
+ pub const CliPkg = struct {
+ name: []const u8,
+ path: []const u8,
+ children: ArrayList(&CliPkg),
+ parent: ?&CliPkg,
+
+ pub fn init(allocator: &mem.Allocator, name: []const u8, path: []const u8, parent: ?&CliPkg) !&CliPkg {
+ var pkg = try allocator.create(CliPkg);
+ pkg.name = name;
+ pkg.path = path;
+ pkg.children = ArrayList(&CliPkg).init(allocator);
+ pkg.parent = parent;
+ return pkg;
+ }
+
+ pub fn deinit(self: &CliPkg) void {
+ for (self.children.toSliceConst()) |child| {
+ child.deinit();
+ }
+ self.children.deinit();
+ }
+ };
+
pub fn create(allocator: &mem.Allocator, name: []const u8, root_src_path: ?[]const u8, target: &const Target,
kind: Kind, build_mode: builtin.Mode, zig_lib_dir: []const u8, cache_dir: []const u8) !&Module
{