Regarding `hlsl_deref_is_lowered()`, I would like to keep it since it doesn't hurt (doesn't require ctx), its name makes is clear what we are checking for, instead of just checking for `deref->data_type` (which wouldn't be enough if we had accepted !343).
Additionally, in further passes I introduce many asserts like
assert(!hlsl_deref_is_lowered(lhs));
- hlsl_deref_get_type(), which feels like it should just have "if (deref->data_type) return deref->data_type;"
We can do that, but the current version has the benefit of explaining that deref->data_type is not used if the deref is not lowered yet. That deref->data_type is the way that we check that is just a coincidence.
Yeah, that makes enough sense to me.
*dump_deref(), which I'm not sure why it needs to call that function at all? Why isn't that just "else"?
Because there is the possibility of a path deref to have path_len=0, if it is a direct reference to the variable, and I think we don't want to write those as `[0]` or `[[]]`.
Well, this is a pretty small thing, I can totally replace the hlsl_deref_is_lowered() calls with deref->data_type checks if you want.
This one still bothers me. Neither [0] nor [[]] is actually wrong in that case, but moreover, I'd expect that if we're using hlsl_deref_is_lowered() then it should look something like
if (hlsl_deref_is_lowered()) { // dump the offset } else { // dump the path }
rather than this else-if logic we have.