Skip to content

Commit 78934b0

Browse files
author
Cameron Zwarich
committed
Add a kind_of_move_of_path method to FlowedMoveData.
1 parent 40e3fb4 commit 78934b0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/librustc/middle/borrowck/move_data.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,28 @@ impl<'a> FlowedMoveData<'a> {
537537
})
538538
}
539539

540+
pub fn kind_of_move_of_path(&self,
541+
id: ast::NodeId,
542+
loan_path: &Rc<LoanPath>)
543+
-> Option<MoveKind> {
544+
//! Returns the kind of a move of `loan_path` by `id`, if one exists.
545+
546+
let mut ret = None;
547+
for loan_path_index in self.move_data.path_map.borrow().find(&*loan_path).iter() {
548+
self.dfcx_moves.each_gen_bit_frozen(id, |move_index| {
549+
let move = self.move_data.moves.borrow();
550+
let move = move.get(move_index);
551+
if move.path == **loan_path_index {
552+
ret = Some(move.kind);
553+
false
554+
} else {
555+
true
556+
}
557+
});
558+
}
559+
ret
560+
}
561+
540562
pub fn each_move_of(&self,
541563
id: ast::NodeId,
542564
loan_path: &Rc<LoanPath>,

0 commit comments

Comments
 (0)