Closed Sergio0694 closed 11 months ago
Does this mean you can't have a local variable and a private field with the same name, and be able to access both?
Correct, that's also another problem I'm not entirely sure how to solve. Currently that will compile just fine, but the rewriter will just drop this.
, so you'll just end up assigning the variable to itself, which compiles fine but just does nothing. I suppose I should special case that check and emit another diagnostic, probably 🤔
Correct, that's also another problem I'm not entirely sure how to solve.
Rename instance fields? e.g. private float value;
--> private float __this_value;
Yeah that might be a simpler solution actually 😄
Closes #480
Description
This PR adds a new diagnostic error when using invalid
this
expressions in a shader (either DX12 or D2D). Usingthis
is allowed for member accesses (eg.this.field
), because the HLSL rewriter is rewriting those and omitting thethis
identifier in the final HLSL source, but the keyword itself is not actually valid in HLSL. So we now have a nice diagnostic rather than an obscure error.