From d0a4a193e372479024f789bcaf5f90bda305ca7f Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Thu, 17 Feb 2022 09:09:28 -0500 Subject: [PATCH] Fix resetting WGSL parser --- src/front/wgsl/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/front/wgsl/mod.rs b/src/front/wgsl/mod.rs index 8b2172c88b..6d2f0fa46e 100644 --- a/src/front/wgsl/mod.rs +++ b/src/front/wgsl/mod.rs @@ -1242,6 +1242,13 @@ impl Parser { } } + fn reset(&mut self) { + self.scopes.clear(); + self.module_scope_identifiers.clear(); + self.lookup_type.clear(); + self.layouter.clear(); + } + fn push_scope(&mut self, scope: Scope, lexer: &Lexer<'_>) { self.scopes.push((scope, lexer.current_byte_offset())); } @@ -4344,9 +4351,7 @@ impl Parser { } pub fn parse(&mut self, source: &str) -> Result { - self.scopes.clear(); - self.lookup_type.clear(); - self.layouter.clear(); + self.reset(); let mut module = crate::Module::default(); let mut lexer = Lexer::new(source);