Skip to content

Commit

Permalink
🐛 output variables now match expression order
Browse files Browse the repository at this point in the history
We actually sort the expression list to be in index-ascending order so
the target of the expressions matches the index of the setting
channel.
  • Loading branch information
rneswold committed Jul 24, 2024
1 parent 5dca64f commit 6397bb7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drmemd/src/logic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,17 @@ impl Node {
.collect();
let mut exprs = exprs?;

// Sort the expressions based on the index of the outputs. The
// output variables are in a hash map, so the vector is built
// in whatever order the map uses. This might not be the same
// order that the expressions are given. By sorting the
// expressions, we line them up so they can be zipped together
// later in this function.

exprs[..].sort_unstable_by(
|compile::Program(_, a), compile::Program(_, b)| a.cmp(b),
);

// Look at each expression and see if it needs the
// time-of-day.

Expand Down

0 comments on commit 6397bb7

Please sign in to comment.