scripts: csv.py: Reverted define filtering to before expr eval

It's just too unintuitive to filter after exprs.

Note this is consistent with how exprs/mods are evaluated. Exprs/mods
can't reference other exprs/mods because csv.py is only single-pass, so
allowing defines to reference exprs/mods is surprising.

And the solution to needing these sort of post-expr/mod references is
the same for defines: You can always chain multiple csv.py calls.

The reason defines were change to evaluate after expr eval was because
this seemed inconsistent with other result scripts, but this is not
actually the case. Other result scripts simply don't have exprs/mods, so
filtering in fold is the same as filtering during collection. Note that
even in fold, filtering is done _before_ the actual fold/sum operation.

---

Also fixed a recursive-define regression when folding. Counter-
intuitively, we _don't_ want to recursively apply define filters. If we
do the results will just end up too confusing to be useful.
This commit is contained in:
Christopher Haster
2025-02-28 23:34:52 -06:00
parent e851c654c5
commit 2f20f53e90
9 changed files with 24 additions and 18 deletions

View File

@@ -603,7 +603,7 @@ def fold(Result, results, *,
Result._children: fold(
Result, getattr(r, Result._children),
by=by,
defines=defines,
# only filter defines at the top level!
sort=sort,
depth=depth-1)})
for r in folded]