mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[glsl-in] Allow expression statements to begin with ++ or --
This would otherwise cause the parser to enter an infinite loop. Fixes #1232
This commit is contained in:
committed by
Dzmitry Malyshau
parent
f14817e8a0
commit
fc47008d0c
@@ -495,6 +495,8 @@ impl<'source> ParsingContext<'source> {
|
||||
| TokenValue::Bang
|
||||
| TokenValue::Tilde
|
||||
| TokenValue::LeftParen
|
||||
| TokenValue::Increment
|
||||
| TokenValue::Decrement
|
||||
| TokenValue::Identifier(_)
|
||||
| TokenValue::TypeName(_)
|
||||
| TokenValue::IntConstant(_)
|
||||
|
||||
@@ -778,9 +778,10 @@ fn swizzles() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vector_indexing() {
|
||||
fn expressions() {
|
||||
let mut parser = Parser::default();
|
||||
|
||||
// Vector indexing
|
||||
parser
|
||||
.parse(
|
||||
&Options::from(ShaderStage::Vertex),
|
||||
@@ -795,4 +796,20 @@ fn vector_indexing() {
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Prefix increment/decrement
|
||||
parser
|
||||
.parse(
|
||||
&Options::from(ShaderStage::Vertex),
|
||||
r#"
|
||||
# version 450
|
||||
void main() {
|
||||
uint index = 0;
|
||||
|
||||
--index;
|
||||
++index;
|
||||
}
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user