hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit ee2316a9bf4d81fa988714e3583d9a2b10d20c49
parent be763d37941a511b700ed9e4fef467a1f803c111
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri, 12 Mar 2021 14:38:45 -0500

build: link with all implicated modules

Diffstat:
Mplan.ha | 5+++--
Msubcmds.ha | 6++----
2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/plan.ha b/plan.ha @@ -100,7 +100,7 @@ fn ident_hash(ident: ast::ident) u32 = { return fnv::sum32(hash); }; -fn sched_module(plan: *plan, ident: ast::ident) *task = { +fn sched_module(plan: *plan, ident: ast::ident, link: *[]*task) *task = { let hash = ident_hash(ident); // TODO: We should not have to dereference the bucket for len or append // TODO: We should not have to cast the length to u32 @@ -123,12 +123,13 @@ fn sched_module(plan: *plan, ident: ast::ident) *task = { let depends: []*task = []; for (let i = 0z; i < len(ver.depends); i += 1) { const dep = ver.depends[i]; - let obj = sched_module(plan, dep); + let obj = sched_module(plan, dep, link); append(depends, obj); }; let obj = sched_hare_object(plan, ver, ident, depends...); append(*bucket, modcache { hash = hash, task = obj }); + append(*link, obj); free(depends); return obj; }; diff --git a/subcmds.ha b/subcmds.ha @@ -86,8 +86,7 @@ fn build(args: []str) void = { let depends: []*task = []; for (let i = 0z; i < len(ver.depends); i += 1z) { const dep = ver.depends[i]; - let obj = sched_module(&plan, dep); - append(depends, obj); + sched_module(&plan, dep, &depends); }; // TODO: Choose this more intelligently @@ -169,8 +168,7 @@ fn run(args: []str) void = { let depends: []*task = []; for (let i = 0z; i < len(ver.depends); i += 1z) { const dep = ver.depends[i]; - let obj = sched_module(&plan, dep); - append(depends, obj); + sched_module(&plan, dep, &depends); }; let output = mkfile(&plan, "out");