EmbarkStudios / spirt

SPIR-🇹: shader-focused IR to target, transform and translate from 🦀
Apache License 2.0
102 stars 9 forks source link

transform: simplify `transform!` to not recurse on hlists (which confused RA). #23

Closed eddyb closed 1 year ago

eddyb commented 1 year ago

The old transform! macro was turning N variables into nested pairs ("hlists"), and recursing on those, creating variables at every level, etc. etc. - somewhere in that process, RA (rust-analyzer) disagreed with rustc, and produced a dozen false errors if the src/transform.rs file was open.

The new one simply treats all the variables independently, by packaging all the necessary information into values that can be placed into variables with the right name, and making a single decision for "did any change".

I have no idea why I didn't think of this back when I wrote the original one, it's so much simpler.