Open lydell opened 10 years ago
I think this happen because enableHelpers
is a module-global variable. It should be created on each invocation.
Are there any API tests? In case I end up making a PR…
Does it make sense to pass helpers
to each rule, just like inScope
, ancestry
etc.?
I don't think so. helpers
is something that needs to be mutated (or threaded through return values monadically), right? inScope
and ancestry
are entirely informational. They are built up in the traversal. Rules do not mutate them or pass out new values for them.
Then I don't know how to fix this issue :(
Yeah, it's a shitty one. You can keep the state in the Compiler instance and mutate it there instead of threading it through the compilation rules. It's cleaner. Unfortunately, JavaScript/CoffeeScript do not allow for very powerful abstraction.
I thought about keeping the state on the Compiler instance as well, but the rules don't seem to have access to it?
Just found https://github.com/michaelficarra/CoffeeScriptRedux/commit/efaa09b7183f0d8e43a63c5ae4a9548f42582f08:
next up, remove {h,enabledH}elpers statefulness
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.