Currently the annotate-free-vars pass adds free variable metadata to the AST, but that information is gradually lost when the other passes run. It's inconvenient to always maintain these (for instance reorder-letrec-bindings) but it is really inconvenient that these are not preserved. It's also slow to recompute on each AST change.
Perhaps keeping these annotations in sync could be extracted into a generic AST walker and intertwined with the other passes?
Currently the
annotate-free-vars
pass adds free variable metadata to the AST, but that information is gradually lost when the other passes run. It's inconvenient to always maintain these (for instancereorder-letrec-bindings
) but it is really inconvenient that these are not preserved. It's also slow to recompute on each AST change. Perhaps keeping these annotations in sync could be extracted into a generic AST walker and intertwined with the other passes?I.e.
...ensures that output of the pass maintains all the free vars correctly.