Skip to content

Commit

Permalink
Fix Scope::exhausted for Scope::ExtensibleSequences
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerkindt committed May 17, 2021
1 parent 4fc11b8 commit 6c9f334
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/syn/io/uper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
}

Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 6c9f334

Please sign in to comment.