Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Recursive apply #136

Merged
merged 2 commits into from Mar 22, 2021
Merged

Recursive apply #136

merged 2 commits into from Mar 22, 2021

Conversation

RobinMalfait
Copy link
Contributor

@RobinMalfait RobinMalfait commented Mar 22, 2021

Add a naive implementation of the recursive @apply.
We can improve this if this causes actual issues.

For example, currently in the tests are are running through the plugin 4 times.
If we create a dependency graph instead, then we could do a topological sort so that we only have to loop through the apply plugin once.
This improvement will also make it easier to detect cycles (currently we would loop forever).

Fixes: #66

Currently what it will do is re-run the apply code. If it turns out that
there are @apply rules left, then it will re-apply those. If there are
no @apply rules left, this means that we are "done".

One big downside is that we are (at the time of this commit) running the
apply code for the test at least 4 times. The good part is that we are
doing it on the exact same tree so we don't need to re-parse it.

This is the first implementation which can be improved!
@RobinMalfait RobinMalfait changed the title recursive apply Recursive apply Mar 22, 2021
@adamwathan adamwathan merged commit ca2cf01 into main Mar 22, 2021
@adamwathan adamwathan deleted the recursive-apply branch March 22, 2021 12:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for recursive @apply
2 participants