aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted/module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-04-13 11:16:06 -0400
committerGitHub <noreply@github.com>2018-04-13 11:16:06 -0400
commit30c5f3c441e6090f29c0540b1fa8a20d6bd2fc0d (patch)
tree420a68427efe9c2e3f95f50f3f56ebc9ca7aa14d /src-self-hosted/module.zig
parent1999f0daad505f414f97845ecde0a56b3c2fedfd (diff)
parentfe9489ad63ea8231bb0366d7608e52d0d30bfefb (diff)
downloadzig-30c5f3c441e6090f29c0540b1fa8a20d6bd2fc0d.tar.gz
zig-30c5f3c441e6090f29c0540b1fa8a20d6bd2fc0d.zip
Merge pull request #915 from zig-lang/self-hosted-cli
Revise self-hosted command line interface
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
{