From 9a856917b6f618d886b3ec2aaca6a1abbe0e6199 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 29 Jan 2025 00:22:04 +0100 Subject: [PATCH] Restore counters before returning the error. (#2399) This restores `self.symbol_counters` before the error is propagated upwards. Without this, we get a panic at the `unwrap()` because the same thing is probably done further up in the call chain. --- pil-analyzer/src/pil_analyzer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pil-analyzer/src/pil_analyzer.rs b/pil-analyzer/src/pil_analyzer.rs index 56ff47e2dd..5cd88a6fb4 100644 --- a/pil-analyzer/src/pil_analyzer.rs +++ b/pil-analyzer/src/pil_analyzer.rs @@ -488,9 +488,9 @@ impl PILAnalyzer { let mut counters = self.symbol_counters.take().unwrap(); let items = StatementProcessor::new(self.driver(), &mut counters, self.polynomial_degree) - .handle_statement(statement)?; + .handle_statement(statement); self.symbol_counters = Some(counters); - for item in items { + for item in items? { match item { PILItem::Definition(symbol, value) => { let name = symbol.absolute_name.clone();