mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[glsl-in] Avoid infinite loop when parsing invalid statements (#1280)
This commit is contained in:
@@ -493,25 +493,16 @@ impl<'source> ParsingContext<'source> {
|
||||
|
||||
meta
|
||||
}
|
||||
TokenValue::Plus
|
||||
| TokenValue::Dash
|
||||
| TokenValue::Bang
|
||||
| TokenValue::Tilde
|
||||
| TokenValue::LeftParen
|
||||
| TokenValue::Increment
|
||||
| TokenValue::Decrement
|
||||
| TokenValue::Identifier(_)
|
||||
| TokenValue::TypeName(_)
|
||||
| TokenValue::IntConstant(_)
|
||||
| TokenValue::BoolConstant(_)
|
||||
| TokenValue::FloatConstant(_) => {
|
||||
TokenValue::Semicolon => self.bump(parser)?.meta,
|
||||
_ => {
|
||||
// Attempt to force expression parsing for remainder of the
|
||||
// tokens. Unknown or invalid tokens will be caught there and
|
||||
// turned into an error.
|
||||
let mut stmt = ctx.stmt_ctx();
|
||||
let expr = self.parse_expression(parser, ctx, &mut stmt, body)?;
|
||||
ctx.lower(stmt, parser, expr, ExprPos::Rhs, body)?;
|
||||
self.expect(parser, TokenValue::Semicolon)?.meta
|
||||
}
|
||||
TokenValue::Semicolon => self.bump(parser)?.meta,
|
||||
_ => meta,
|
||||
};
|
||||
|
||||
Ok(Some(meta.union(&meta_rest)))
|
||||
|
||||
Reference in New Issue
Block a user