Get the position that a `cursor.prev_inst()` call would move this cursor to, but do not update this cursor's position.
(&self)
| 469 | /// Get the position that a `cursor.prev_inst()` call would move this cursor |
| 470 | /// to, but do not update this cursor's position. |
| 471 | fn prev_inst_position(&self) -> Option<CursorPosition> { |
| 472 | use self::CursorPosition::*; |
| 473 | match self.position() { |
| 474 | Nowhere | Before(..) => None, |
| 475 | At(inst) => { |
| 476 | if let Some(prev) = self.layout().prev_inst(inst) { |
| 477 | Some(At(prev)) |
| 478 | } else { |
| 479 | Some(Before( |
| 480 | self.layout() |
| 481 | .inst_block(inst) |
| 482 | .expect("current instruction removed?"), |
| 483 | )) |
| 484 | } |
| 485 | } |
| 486 | After(block) => { |
| 487 | if let Some(prev) = self.layout().last_inst(block) { |
| 488 | Some(At(prev)) |
| 489 | } else { |
| 490 | Some(Before(block)) |
| 491 | } |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | /// Move to the previous instruction in the same block and return it. |
| 497 | /// |