From 6c9f334923e08d04427c98e04bfbe43eddad1f97 Mon Sep 17 00:00:00 2001 From: Michael Watzko Date: Mon, 17 May 2021 16:18:05 +0200 Subject: [PATCH] Fix Scope::exhausted for Scope::ExtensibleSequences --- src/syn/io/uper.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/syn/io/uper.rs b/src/syn/io/uper.rs index 944e32a2..45be70cf 100644 --- a/src/syn/io/uper.rs +++ b/src/syn/io/uper.rs @@ -51,7 +51,17 @@ impl Scope { match self { Scope::OptBitField(range) => range.start == range.end, Scope::AllBitField(range) => range.start == range.end, - Scope::ExtensibleSequence { .. } => false, + Scope::ExtensibleSequence { + opt_bit_field, + calls_until_ext_bitfield, + number_of_ext_fields, + } => { + *calls_until_ext_bitfield == *number_of_ext_fields + && match opt_bit_field { + Some(range) => range.start == range.end, + None => true, + } + } } } @@ -221,6 +231,7 @@ impl UperWriter { let result = f(self); let scope = core::mem::replace(&mut self.scope, original); // save because this is supposed to be the original from above + let exhausted = scope.as_ref().unwrap().exhausted(); debug_assert!(scope.unwrap().exhausted()); result }