tighten up invariants

This commit is contained in:
Aleksey Kladov 2021-12-12 19:22:37 +03:00
parent 18d4737fb9
commit 57e6ef0bfb
3 changed files with 17 additions and 14 deletions

View file

@ -51,11 +51,8 @@ impl Tokens {
/// tokens.push(curr_joint)
/// ```
#[inline]
pub fn was_joint(&mut self, yes: bool) {
let idx = self.len();
if yes && idx > 0 {
self.set_joint(idx - 1);
}
pub fn was_joint(&mut self) {
self.set_joint(self.len() - 1);
}
#[inline]
pub fn push_ident(&mut self, contextual_kw: SyntaxKind) {