As defined in the GLSL grammar, postfix expressions may be suffixed by an integer expression between brackets to index primary expressions such as matrices and arrays. The AST represents such suffix with a Bracket node.
This node was slightly refactored when ported from the glsl crate to contain an expression instead of an array specifier, which better follows the GLSL grammar, but introduced a regression due to not explicitly writing the necessary brackets. For example, this input:
void main() { ProjMat[0][0] = 0.0; }
Would transpile to the following incorrect output:
void main() { ProjMat00 = 0.0; }
To fix this, surround the integer expression between brackets and add the corresponding regression test.
As defined in the GLSL grammar, postfix expressions may be suffixed by an integer expression between brackets to index primary expressions such as matrices and arrays. The AST represents such suffix with a Bracket node.
This node was slightly refactored when ported from the glsl crate to contain an expression instead of an array specifier, which better follows the GLSL grammar, but introduced a regression due to not explicitly writing the necessary brackets. For example, this input:
Would transpile to the following incorrect output:
To fix this, surround the integer expression between brackets and add the corresponding regression test.