(&self, pos: Position<NodeId>)
| 197 | } |
| 198 | |
| 199 | fn find_block(&self, pos: Position<NodeId>) -> PristineResult<GraphNode<NodeId>> { |
| 200 | if pos.change.is_root() { |
| 201 | return Ok(GraphNode::ROOT); |
| 202 | } |
| 203 | |
| 204 | let change_id = pos.change.get(); |
| 205 | let target_pos = pos.pos.get(); |
| 206 | self.ensure_loaded(change_id)?; |
| 207 | |
| 208 | if let Some((s, e)) = self.index.borrow().find_block(change_id, target_pos) { |
| 209 | return Ok(GraphNode { |
| 210 | change: NodeId::new(change_id), |
| 211 | start: ChangePosition::new(s), |
| 212 | end: ChangePosition::new(e), |
| 213 | }); |
| 214 | } |
| 215 | |
| 216 | Err(PristineError::BlockNotFound { |
| 217 | change: change_id, |
| 218 | pos: target_pos, |
| 219 | }) |
| 220 | } |
| 221 | |
| 222 | fn find_block_end(&self, pos: Position<NodeId>) -> PristineResult<GraphNode<NodeId>> { |
| 223 | if pos.change.is_root() { |
no test coverage detected