Truncate the context to the given length, dropping any declarations pushed since. The dropped fvars become unresolvable via [`Self::find`].
(&mut self, len: usize)
| 115 | /// Truncate the context to the given length, dropping any declarations |
| 116 | /// pushed since. The dropped fvars become unresolvable via [`Self::find`]. |
| 117 | pub fn truncate(&mut self, len: usize) { |
| 118 | while self.decls.len() > len { |
| 119 | let (id, _) = self.decls.pop().expect("len > 0 by loop guard"); |
| 120 | self.index.remove(&id); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /// Iterate decls in insertion order. |
| 125 | pub fn iter(&self) -> impl Iterator<Item = (FVarId, &LocalDecl<M>)> { |