Add EvalAltResult::clear_position().

This commit is contained in:
Stephen Chung
2021-01-08 14:29:57 +08:00
parent ec18bd26a2
commit b96c832141
4 changed files with 13 additions and 9 deletions

View File

@@ -366,6 +366,11 @@ impl EvalAltResult {
| Self::Return(_, pos) => *pos,
}
}
/// Clear the [position][Position] information of this error.
pub fn clear_position(&mut self) -> &mut Self {
self.set_position(Position::NONE);
self
}
/// Override the [position][Position] of this error.
pub fn set_position(&mut self, new_position: Position) {
match self {