hare

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

commit c2f81855ffd18e84231b32a67aaf3d75efa01fd6
parent 04b93b6e5ba494f7ae8c65d08f9b10fd07173b66
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed, 10 Mar 2021 11:41:15 -0500

Choose next eligible task to build

Diffstat:
Mmain.ha | 16++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/main.ha b/main.ha @@ -67,10 +67,18 @@ export fn main() void = { let next: nullable *task = null; let i = 0z; for (i < len(plan.scheduled); i += 1) { - // TODO: Check dependencies and pick the next eligible - // task instead - next = plan.scheduled[i]; - break; + let task = plan.scheduled[i]; + let eligible = true; + for (let j = 0z; j < len(task.depend); j += 1) { + if (task.depend[j].status != status::COMPLETE) { + eligible = false; + break; + }; + }; + if (eligible) { + next = task; + break; + }; }; // TODO: This can be a type assertion let task = match (next) {